Removes the link between a replica secret and its primary secret, and stops replication to the replica. You call this operation from the replica account or Region. Depending on the type of replica, the behavior is:
-
Cross-Region replica: promotes the replica to a standalone primary secret in the replica Region.
-
Cross-account replica: promotes the replica in your account to a standalone secret and stops replication from its primary secret in the other account. Secrets Manager updates the primary secret's replication status to Detached for this replica.
To stop cross-account replication from the primary account instead, use DisassociateCrossAccountReplica.
Secrets Manager generates a CloudTrail log entry when you call this action. Do not include sensitive information in request parameters because it might be logged. For more information, see Logging Secrets Manager events with CloudTrail.
Required permissions: secretsmanager:StopReplicationToReplica. For cross-account replica secrets, you must also have secretsmanager:DeleteResourcePolicy permissions. For more information, see IAM policy actions for Secrets Manager and Authentication and access control in Secrets Manager.
Parameters:
-
secret_id
(SecretIdType)
–
The ARN or name of the replica secret.
For a cross-region replica, the replica ARN is the same as the original primary secret ARN except that the Region is changed to the replica Region. For a cross-account replica, this is the ARN or name of the replica secret in your account.
Raises:
Examples:
To stop cross-account replication from the replica account
The following example, called from the replica account, unlinks a cross-account replica secret from its primary secret in another account and stops replication. The secret remains in the replica account as a standalone secret.
>>> client.stop_replication_to_replica(secret_id='arn:aws:secretsmanager:us-west-2:222222222222:secret:MyReplicaSecret-a1b2c3')
Source code in docs_src/capo_secrets_manager/_services/secrets_manager.py
| def stop_replication_to_replica(
self,
secret_id: "capo_secrets_manager.types.secret_id_type.SecretIdType",
*,
config_overrides: Optional[SecretsManagerClientConfig] = None,
) -> "capo_secrets_manager.types.stop_replication_to_replica_response.StopReplicationToReplicaResponse":
"""<p>Removes the link between a replica secret and its primary secret, and stops replication to the replica. You call this operation from the replica account or Region. Depending on the type of replica, the behavior is:</p> <ul> <li> <p> <b>Cross-Region replica</b>: promotes the replica to a standalone primary secret in the replica Region.</p> </li> <li> <p> <b>Cross-account replica</b>: promotes the replica in your account to a standalone secret and stops replication from its primary secret in the other account. Secrets Manager updates the primary secret's replication status to <code>Detached</code> for this replica.</p> </li> </ul> <p>To stop cross-account replication from the primary account instead, use <a>DisassociateCrossAccountReplica</a>.</p> <p>Secrets Manager generates a CloudTrail log entry when you call this action. Do not include sensitive information in request parameters because it might be logged. For more information, see <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html">Logging Secrets Manager events with CloudTrail</a>.</p> <p> <b>Required permissions: </b> <code>secretsmanager:StopReplicationToReplica</code>. For cross-account replica secrets, you must also have <code>secretsmanager:DeleteResourcePolicy</code> permissions. For more information, see <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions"> IAM policy actions for Secrets Manager</a> and <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html">Authentication and access control in Secrets Manager</a>. </p>
Args:
secret_id: <p>The ARN or name of the replica secret.</p> <p>For a cross-region replica, the replica ARN is the same as the original primary secret ARN except that the Region is changed to the replica Region. For a cross-account replica, this is the ARN or name of the replica secret in your account.</p>
Raises:
capo_secrets_manager.errors.internal_service_error.InternalServiceError: <p>An error occurred on the server side.</p>
capo_secrets_manager.errors.invalid_parameter_exception.InvalidParameterException: <p>The parameter name or value is invalid.</p>
capo_secrets_manager.errors.invalid_request_exception.InvalidRequestException: <p>A parameter value is not valid for the current state of the resource.</p> <p>Possible causes:</p> <ul> <li> <p>The secret is scheduled for deletion.</p> </li> <li> <p>You tried to enable rotation on a secret that doesn't already have a Lambda function ARN configured and you didn't include such an ARN as a parameter in this call. </p> </li> <li> <p>The secret is managed by another service, and you must use that service to update it. For more information, see <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/service-linked-secrets.html">Secrets managed by other Amazon Web Services services</a>.</p> </li> </ul>
capo_secrets_manager.errors.resource_not_found_exception.ResourceNotFoundException: <p>Secrets Manager can't find the resource that you asked for.</p>
capo_secrets_manager.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
To stop cross-account replication from the replica account
The following example, called from the replica account, unlinks a cross-account replica secret from its primary secret in another account and stops replication. The secret remains in the replica account as a standalone secret.
>>> client.stop_replication_to_replica(secret_id='arn:aws:secretsmanager:us-west-2:222222222222:secret:MyReplicaSecret-a1b2c3')
"""
def _handler(
req: "OperationRequest[capo_secrets_manager.types.stop_replication_to_replica_request.StopReplicationToReplicaRequest]",
) -> OperationResponse[
"capo_secrets_manager.types.stop_replication_to_replica_response.StopReplicationToReplicaResponse"
]:
import capo_secrets_manager._operations.secretsmanager.stop_replication_to_replica
output, http_response = (
capo_secrets_manager._operations.secretsmanager.stop_replication_to_replica.stop_replication_to_replica(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("StopReplicationToReplica")
)
input_: capo_secrets_manager.types.stop_replication_to_replica_request.StopReplicationToReplicaRequest = {
"secret_id": secret_id
}
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|