2026/11/12 - AWS Secrets Manager - 3 new 7 updated api methods
Changes Adds support for cross-account replication with the new AssociateCrossAccountReplica, DisassociateCrossAccountReplica, and ListResourcePolicies APIs, CrossAccountPrimaryARN in CreateSecret, cross-account replication status in DescribeSecret, and PolicyName in the resource policy APIs.
Removes the link between a primary secret in your account and a cross-account replica secret, and stops replication to the replica secret. Call this operation on the primary secret. This action removes the replica association created by AssociateCrossAccountReplica.
Disassociating the replica from the primary does not delete the replica secret or convert the replica secret to a standalone secret. The replica secret remains in the other account and its replication status changes to Detached. Secrets Manager no longer sends updates from the primary secret to the replica secret after disassociation. To convert a detached replica into a standalone secret, call StopReplicationToReplica on the replica secret.
You must disassociate a cross-account replica before you call DeleteSecret for the primary secret. The DeleteSecret call fails if any replicas are still associated with the primary secret.
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:DisassociateCrossAccountReplica. For more information, see IAM policy actions for Secrets Manager and Authentication and access control in Secrets Manager.
See also: AWS API Documentation
Request Syntax
client.disassociate_cross_account_replica(
SecretId='string',
CrossAccountReplicaARN='string'
)
string
[REQUIRED]
The ARN or name of the primary secret in your account.
For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See Finding a secret from a partial ARN.
string
[REQUIRED]
The ARN of the cross-account replica secret to unlink from the primary secret.
dict
Response Syntax
{
'ARN': 'string',
'CrossAccountReplicaARN': 'string'
}
Response Structure
(dict) --
ARN (string) --
The ARN of the primary secret.
CrossAccountReplicaARN (string) --
The ARN of the replica secret that was unlinked from the primary secret.
Links a primary secret in your account to a replica secret in a different Amazon Web Services account and starts replication to this replica. The replica secret must already exist in the other Amazon Web Services account. Create the replica with CreateSecret and set its CrossAccountPrimaryARN field set to this primary secret's ARN. When you call AssociateCrossAccountReplica, Secrets Manager calls AcceptCrossAccountReplication on the replica secret on your behalf.
The primary and replica secrets must be in the same Amazon Web Services Region and partition, and you must call this operation from the account that owns the primary secret. A primary secret can have at most one cross-account replica. This operation is idempotent, so you can call it again for the same replica to repair replication. If the association fails, Secrets Manager does not modify either the primary or replica secret.
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:AssociateCrossAccountReplica, secretsmanager:GetSecretValue on the primary secret, and secretsmanager:AcceptCrossAccountReplication on the replica secret. You must also have kms:Decrypt permission for the Key Management Service (KMS) key that encrypts the primary secret, and kms:Encrypt permission for the Amazon Web Services KMS key that encrypts the replica secret. If you supply ReplicationRoleARN, you also need iam:PassRole for that role. For more information, see IAM policy actions for Secrets Manager and Authentication and access control in Secrets Manager.
See also: AWS API Documentation
Request Syntax
client.associate_cross_account_replica(
SecretId='string',
CrossAccountReplicaARN='string',
ReplicaRestriction='SameOrg'|'NoRestriction',
ReplicationRoleARN='string'
)
string
[REQUIRED]
The ARN or name of the primary secret in your account to replicate.
For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See Finding a secret from a partial ARN.
string
[REQUIRED]
The ARN of the replica secret in the other Amazon Web Services account. The replica secret must be in the same Region and partition as the primary secret. Additionally, the replica account owner must have created the replica secret as a cross-account replica of the primary secret. For more information see CreateSecret.
string
Whether the replica account must belong to the same Amazon Web Services organization as the primary account:
SameOrg, which requires the replica account to be in the same organization as the primary account. This is the default.
NoRestriction, which allows the replica account to be in any organization.
string
The ARN of an IAM role in the primary account that Secrets Manager assumes to perform replication. If you don't include this field, Secrets Manager replicates using the credentials of caller who updates the primary secret. For more information, see Cross-account replication permissions.
dict
Response Syntax
{
'ARN': 'string',
'CrossAccountReplicaARN': 'string',
'ReplicationStatus': 'InSync'|'Failed'|'InProgress'|'Pending'|'Detached'
}
Response Structure
(dict) --
ARN (string) --
The ARN of the primary secret.
CrossAccountReplicaARN (string) --
The ARN of the replica secret in the other account.
ReplicationStatus (string) --
The status of replication to the replica secret. Possible values:
InSync, which indicates that replication to the replica completed successfully and the replica is up to date.
Failed, which indicates that replication to the replica did not succeed.
InProgress, which indicates that Secrets Manager is replicating to the replica.
Pending, which indicates that replication has not yet started.
Detached, which indicates that primary secret is no longer linked to the replica secret.
Lists the resource-based policies attached to a secret. The response contains only the names of the policies, not their contents. Secrets Manager lists default first, followed by any other policies in alphabetical order. To get the contents of a policy, use GetResourcePolicy. You can modify only the default policy.
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:ListResourcePolicies. For more information, see IAM policy actions for Secrets Manager and Authentication and access control in Secrets Manager.
See also: AWS API Documentation
Request Syntax
client.list_resource_policies(
SecretId='string',
MaxResults=123,
NextToken='string'
)
string
[REQUIRED]
The ARN or name of the secret.
For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See Finding a secret from a partial ARN.
integer
The number of results to include in the response. If you don't specify this value, the service returns up to 100 results.
If there are more results available, in the response, Secrets Manager includes NextToken. To get the next results, call ListResourcePolicies again with the value from NextToken.
string
A token that indicates where the output should continue from, if a previous call did not show all results. To get the next results, call ListResourcePolicies again with this value.
dict
Response Syntax
{
'ResourcePolicies': [
{
'PolicyName': 'string'
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
ResourcePolicies (list) --
A list of the resource policies attached to the secret.
(dict) --
A structure that contains details about a resource policy attached to a secret. It does not contain the contents of the resource policy. To view the contents of the policy, use GetResourcePolicy .
PolicyName (string) --
The name of the resource policy.
NextToken (string) --
Secrets Manager includes this value if there's more output available than what is included in the current response. To get the next results, call ListResourcePolicies again with this value.
{'CrossAccountPrimaryARN': 'string'}
Response {'ReplicationStatus': {'Status': {'Pending', 'Detached'}}}
Creates a new secret. A secret can be a password, a set of credentials such as a user name and password, an OAuth token, or other secret information that you store in an encrypted form in Secrets Manager. The secret also includes the connection information to access a database or other service. Secrets Manager does not encrypt this connection information. A secret in Secrets Manager consists of both the encrypted secret versions and the metadata that Secrets Manager uses to manage the secret.
For secrets that use managed rotation, you need to create the secret through the managing service. For more information, see Secrets Manager secrets managed by other Amazon Web Services services.
For information about creating a secret in the console, see Create a secret.
To create a secret, you can provide the secret value to be encrypted in either the SecretString parameter or the SecretBinary parameter, but not both. If you include SecretString or SecretBinary, then Secrets Manager creates an initial secret version and automatically attaches the staging label AWSCURRENT to it.
For database credentials you want to rotate, for Secrets Manager to be able to rotate the secret, you must make sure the JSON you store in the SecretString matches the JSON structure of a database secret.
If you don't specify an KMS encryption key, Secrets Manager uses the Amazon Web Services managed key aws/secretsmanager. If this key doesn't already exist in your account, then Secrets Manager creates it for you automatically. All users and roles in the Amazon Web Services account automatically have access to use aws/secretsmanager. Creating aws/secretsmanager can result in a one-time delay to complete the secret creation.
If the secret is in a different Amazon Web Services account from the credentials calling the API, then you can't use aws/secretsmanager to encrypt the secret, and you must create and use a customer managed KMS key.
To create a cross-account replica secret, include CrossAccountPrimaryARN. The replica must use a customer managed KMS key, and can't include AddReplicaRegions, Description, SecretBinary, SecretString, or Type.
Secrets Manager generates a CloudTrail log entry when you call this action. Do not include sensitive information in request parameters except SecretBinary or SecretString because it might be logged. For more information, see Logging Secrets Manager events with CloudTrail.
Required permissions: secretsmanager:CreateSecret. If you include tags in the secret, you also need secretsmanager:TagResource. To add replica Regions, you must also have secretsmanager:ReplicateSecretToRegions. To create a cross-account replica secret, you must also have secretsmanager:PutResourcePolicy permissions. For more information, see IAM policy actions for Secrets Manager and Authentication and access control in Secrets Manager.
To encrypt the secret with a KMS key other than aws/secretsmanager, you need kms:GenerateDataKey and kms:Decrypt permission to the key.
See also: AWS API Documentation
Request Syntax
client.create_secret(
Name='string',
ClientRequestToken='string',
Description='string',
KmsKeyId='string',
SecretBinary=b'bytes',
SecretString='string',
Tags=[
{
'Key': 'string',
'Value': 'string'
},
],
AddReplicaRegions=[
{
'Region': 'string',
'KmsKeyId': 'string'
},
],
ForceOverwriteReplicaSecret=True|False,
Type='string',
CrossAccountPrimaryARN='string'
)
string
[REQUIRED]
The name of the new secret.
The secret name can contain ASCII letters, numbers, and the following characters: /_+=.@-
Do not end your secret name with a hyphen followed by six characters. If you do so, you risk confusion and unexpected results when searching for a secret by partial ARN. Secrets Manager automatically adds a hyphen and six random characters after the secret name at the end of the ARN.
string
If you include SecretString or SecretBinary, then Secrets Manager creates an initial version for the secret, and this parameter specifies the unique identifier for the new version.
If you generate a raw HTTP request to the Secrets Manager service endpoint, then you must generate a ClientRequestToken and include it in the request.
This value helps ensure idempotency. Secrets Manager uses this value to prevent the accidental creation of duplicate versions if there are failures and retries during a rotation. We recommend that you generate a UUID-type value to ensure uniqueness of your versions within the specified secret.
If the ClientRequestToken value isn't already associated with a version of the secret then a new version of the secret is created.
If a version with this value already exists and the version SecretString and SecretBinary values are the same as those in the request, then the request is ignored.
If a version with this value already exists and that version's SecretString and SecretBinary values are different from those in the request, then the request fails because you cannot modify an existing version. Instead, use PutSecretValue to create a new version.
This value becomes the VersionId of the new version.
This field is autopopulated if not provided.
string
The description of the secret.
string
The ARN, key ID, or alias of the KMS key that Secrets Manager uses to encrypt the secret value in the secret. An alias is always prefixed by alias/, for example alias/aws/secretsmanager. For more information, see About aliases.
To use a KMS key in a different account, use the key ARN or the alias ARN.
If you don't specify this value, then Secrets Manager uses the key aws/secretsmanager. If that key doesn't yet exist, then Secrets Manager creates it for you automatically the first time it encrypts the secret value.
If the secret is in a different Amazon Web Services account from the credentials calling the API, then you can't use aws/secretsmanager to encrypt the secret, and you must create and use a customer managed KMS key.
bytes
The binary data to encrypt and store in the new version of the secret. We recommend that you store your binary data in a file and then pass the contents of the file as a parameter.
Either SecretString or SecretBinary must have a value, but not both.
This parameter is not available in the Secrets Manager console.
Sensitive: This field contains sensitive information, so the service does not include it in CloudTrail log entries. If you create your own log entries, you must also avoid logging the information in this field.
string
The text data to encrypt and store in this new version of the secret. We recommend you use a JSON structure of key/value pairs for your secret value.
Either SecretString or SecretBinary must have a value, but not both.
If you create a secret by using the Secrets Manager console then Secrets Manager puts the protected secret text in only the SecretString parameter. The Secrets Manager console stores the information as a JSON structure of key/value pairs that a Lambda rotation function can parse.
Sensitive: This field contains sensitive information, so the service does not include it in CloudTrail log entries. If you create your own log entries, you must also avoid logging the information in this field.
list
A list of tags to attach to the secret. Each tag is a key and value pair of strings in a JSON text string, for example:
[{"Key":"CostCenter","Value":"12345"},{"Key":"environment","Value":"production"}]
Secrets Manager tag key names are case sensitive. A tag with the key "ABC" is a different tag from one with key "abc".
If you check tags in permissions policies as part of your security strategy, then adding or removing a tag can change permissions. If the completion of this operation would result in you losing your permissions for this secret, then Secrets Manager blocks the operation and returns an Access Denied error. For more information, see Control access to secrets using tags and Limit access to identities with tags that match secrets' tags.
For information about how to format a JSON parameter for the various command line tool environments, see Using JSON for Parameters. If your command-line tool or SDK requires quotation marks around the parameter, you should use single quotes to avoid confusion with the double quotes required in the JSON text.
For tag quotas and naming restrictions, see Service quotas for Tagging in the Amazon Web Services General Reference guide.
(dict) --
A structure that contains information about a tag.
Key (string) --
The key identifier, or name, of the tag.
Value (string) --
The string value associated with the key of the tag.
list
A list of Regions and KMS keys to replicate secrets.
(dict) --
A custom type that specifies a Region and the KmsKeyId for a replica secret.
Region (string) --
A Region code. For a list of Region codes, see Name and code of Regions.
KmsKeyId (string) --
The ARN, key ID, or alias of the KMS key to encrypt the secret. If you don't include this field, Secrets Manager uses aws/secretsmanager.
boolean
Specifies whether to overwrite a secret with the same name in the destination Region. By default, secrets aren't overwritten.
string
The exact string that identifies the partner that holds the external secret. For more information, see Using Secrets Manager managed external secrets.
string
The ARN of a primary secret in another Amazon Web Services account. Include this field to create a cross-account replica secret that receives replicated data from that primary secret. The primary secret must be in the same Amazon Web Services Region and partition as the replica, and you must specify a customer managed KMS key in KmsKeyId. You can't include SecretString, SecretBinary, Description, AddReplicaRegions, or Type.
dict
Response Syntax
{
'ARN': 'string',
'Name': 'string',
'VersionId': 'string',
'ReplicationStatus': [
{
'Region': 'string',
'KmsKeyId': 'string',
'Status': 'InSync'|'Failed'|'InProgress'|'Pending'|'Detached',
'StatusMessage': 'string',
'LastAccessedDate': datetime(2015, 1, 1)
},
]
}
Response Structure
(dict) --
ARN (string) --
The ARN of the new secret. The ARN includes the name of the secret followed by six random characters. This ensures that if you create a new secret with the same name as a deleted secret, then users with access to the old secret don't get access to the new secret because the ARNs are different.
Name (string) --
The name of the new secret.
VersionId (string) --
The unique identifier associated with the version of the new secret.
ReplicationStatus (list) --
A list of the replicas of this secret and their status:
Failed, which indicates that the replica was not created.
InProgress, which indicates that Secrets Manager is in the process of creating the replica.
InSync, which indicates that the replica was created.
(dict) --
A replication object consisting of a RegionReplicationStatus object and includes a Region, KMSKeyId, status, and status message.
Region (string) --
The Region where replication occurs.
KmsKeyId (string) --
Can be an ARN, Key ID, or Alias.
Status (string) --
The status can be InProgress, Failed, or InSync.
StatusMessage (string) --
Status message such as "Secret with this name already exists in this region".
LastAccessedDate (datetime) --
The date that the secret was last accessed in the Region. This field is omitted if the secret has never been retrieved in the Region.
{'PolicyName': 'string'}
Deletes the resource-based permission policy attached to the secret. To attach a policy to a secret, use PutResourcePolicy.
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:DeleteResourcePolicy. For more information, see IAM policy actions for Secrets Manager and Authentication and access control in Secrets Manager.
See also: AWS API Documentation
Request Syntax
client.delete_resource_policy(
SecretId='string',
PolicyName='string'
)
string
[REQUIRED]
The ARN or name of the secret to delete the attached resource-based policy for.
For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See Finding a secret from a partial ARN.
string
The name of the resource policy to delete. If you don't specify this field, Secrets Manager uses default. You can only delete the default policy; if you specify any other name, the operation returns an InvalidParameterException.
dict
Response Syntax
{
'ARN': 'string',
'Name': 'string',
'PolicyName': 'string'
}
Response Structure
(dict) --
ARN (string) --
The ARN of the secret that the resource-based policy was deleted for.
Name (string) --
The name of the secret that the resource-based policy was deleted for.
PolicyName (string) --
The name of the deleted resource policy. If you didn't specify PolicyName in the request, this is default.
{'CrossAccountPrimary': {'PrimarySecretARN': 'string',
'ReplicationStatus': 'InSync | Failed | InProgress | '
'Pending | Detached',
'StatusMessage': 'string'},
'CrossAccountReplicas': [{'ReplicaSecretARN': 'string',
'ReplicationRoleARN': 'string',
'ReplicationStatus': 'InSync | Failed | InProgress '
'| Pending | Detached',
'StatusMessage': 'string'}],
'ReplicationStatus': {'Status': {'Pending', 'Detached'}}}
Retrieves the details of a secret. It does not include the encrypted secret value. Secrets Manager only returns fields that have a value in the response.
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:DescribeSecret. For more information, see IAM policy actions for Secrets Manager and Authentication and access control in Secrets Manager.
See also: AWS API Documentation
Request Syntax
client.describe_secret(
SecretId='string'
)
string
[REQUIRED]
The ARN or name of the secret.
For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See Finding a secret from a partial ARN.
dict
Response Syntax
{
'ARN': 'string',
'Name': 'string',
'Type': 'string',
'Description': 'string',
'KmsKeyId': 'string',
'RotationEnabled': True|False,
'RotationLambdaARN': 'string',
'RotationRules': {
'AutomaticallyAfterDays': 123,
'Duration': 'string',
'ScheduleExpression': 'string'
},
'ExternalSecretRotationMetadata': [
{
'Key': 'string',
'Value': 'string'
},
],
'ExternalSecretRotationRoleArn': 'string',
'LastRotatedDate': datetime(2015, 1, 1),
'LastChangedDate': datetime(2015, 1, 1),
'LastAccessedDate': datetime(2015, 1, 1),
'DeletedDate': datetime(2015, 1, 1),
'NextRotationDate': datetime(2015, 1, 1),
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
],
'VersionIdsToStages': {
'string': [
'string',
]
},
'OwningService': 'string',
'CreatedDate': datetime(2015, 1, 1),
'PrimaryRegion': 'string',
'ReplicationStatus': [
{
'Region': 'string',
'KmsKeyId': 'string',
'Status': 'InSync'|'Failed'|'InProgress'|'Pending'|'Detached',
'StatusMessage': 'string',
'LastAccessedDate': datetime(2015, 1, 1)
},
],
'CrossAccountPrimary': {
'PrimarySecretARN': 'string',
'ReplicationStatus': 'InSync'|'Failed'|'InProgress'|'Pending'|'Detached',
'StatusMessage': 'string'
},
'CrossAccountReplicas': [
{
'ReplicaSecretARN': 'string',
'ReplicationRoleARN': 'string',
'ReplicationStatus': 'InSync'|'Failed'|'InProgress'|'Pending'|'Detached',
'StatusMessage': 'string'
},
]
}
Response Structure
(dict) --
ARN (string) --
The ARN of the secret.
Name (string) --
The name of the secret.
Type (string) --
The exact string that identifies the partner that holds the external secret. For more information, see Using Secrets Manager managed external secrets.
Description (string) --
The description of the secret.
KmsKeyId (string) --
The key ID or alias ARN of the KMS key that Secrets Manager uses to encrypt the secret value. If the secret is encrypted with the Amazon Web Services managed key aws/secretsmanager, this field is omitted. Secrets created using the console use an KMS key ID.
RotationEnabled (boolean) --
Specifies whether automatic rotation is turned on for this secret. If the secret has never been configured for rotation, Secrets Manager returns null.
To turn on rotation, use RotateSecret. To turn off rotation, use CancelRotateSecret.
RotationLambdaARN (string) --
The ARN of the Lambda function that Secrets Manager invokes to rotate the secret.
RotationRules (dict) --
The rotation schedule and Lambda function for this secret. If the secret previously had rotation turned on, but it is now turned off, this field shows the previous rotation schedule and rotation function. If the secret never had rotation turned on, this field is omitted.
AutomaticallyAfterDays (integer) --
The number of days between rotations of the secret. You can use this value to check that your secret meets your compliance guidelines for how often secrets must be rotated. If you use this field to set the rotation schedule, Secrets Manager calculates the next rotation date based on the previous rotation. Manually updating the secret value by calling PutSecretValue or UpdateSecret is considered a valid rotation.
In DescribeSecret and ListSecrets, this value is calculated from the rotation schedule after every successful rotation. In RotateSecret, you can set the rotation schedule in RotationRules with AutomaticallyAfterDays or ScheduleExpression, but not both. To set a rotation schedule in hours, use ScheduleExpression.
Duration (string) --
The length of the rotation window in hours, for example 3h for a three hour window. Secrets Manager rotates your secret at any time during this window. The window must not extend into the next rotation window or the next UTC day. The window starts according to the ScheduleExpression. If you don't specify a Duration, for a ScheduleExpression in hours, the window automatically closes after one hour. For a ScheduleExpression in days, the window automatically closes at the end of the UTC day. For more information, including examples, see Schedule expressions in Secrets Manager rotation in the Secrets Manager Users Guide.
ScheduleExpression (string) --
A cron() or rate() expression that defines the schedule for rotating your secret. Secrets Manager rotation schedules use UTC time zone. Secrets Manager rotates your secret any time during a rotation window.
Secrets Manager rate() expressions represent the interval in hours or days that you want to rotate your secret, for example rate(12 hours) or rate(10 days). You can rotate a secret as often as every four hours. If you use a rate() expression, the rotation window starts at midnight. For a rate in hours, the default rotation window closes after one hour. For a rate in days, the default rotation window closes at the end of the day. You can set the Duration to change the rotation window. The rotation window must not extend into the next UTC day or into the next rotation window.
You can use a cron() expression to create a rotation schedule that is more detailed than a rotation interval. For more information, including examples, see Schedule expressions in Secrets Manager rotation in the Secrets Manager Users Guide. For a cron expression that represents a schedule in hours, the default rotation window closes after one hour. For a cron expression that represents a schedule in days, the default rotation window closes at the end of the day. You can set the Duration to change the rotation window. The rotation window must not extend into the next UTC day or into the next rotation window.
ExternalSecretRotationMetadata (list) --
The metadata needed to successfully rotate a managed external secret. A list of key value pairs in JSON format specified by the partner. For more information about the required information, see Managed external secrets partners.
(dict) --
The metadata needed to successfully rotate a managed external secret. A list of key value pairs in JSON format specified by the partner. For more information, see Managed external secret partners.
Key (string) --
The key that identifies the item.
Value (string) --
The value of the specified item.
ExternalSecretRotationRoleArn (string) --
The Amazon Resource Name (ARN) of the role that allows Secrets Manager to rotate a secret held by a third-party partner. For more information, see Security and permissions.
LastRotatedDate (datetime) --
The last date and time that Secrets Manager rotated the secret. If the secret isn't configured for rotation or rotation has been disabled, Secrets Manager returns null.
LastChangedDate (datetime) --
The last date and time that this secret was modified in any way.
LastAccessedDate (datetime) --
The date that the secret was last accessed in the Region. This field is omitted if the secret has never been retrieved in the Region.
DeletedDate (datetime) --
The date the secret is scheduled for deletion. If it is not scheduled for deletion, this field is omitted. When you delete a secret, Secrets Manager requires a recovery window of at least 7 days before deleting the secret. Some time after the deleted date, Secrets Manager deletes the secret, including all of its versions.
If a secret is scheduled for deletion, then its details, including the encrypted secret value, is not accessible. To cancel a scheduled deletion and restore access to the secret, use RestoreSecret.
NextRotationDate (datetime) --
The next rotation is scheduled to occur on or before this date. If the secret isn't configured for rotation or rotation has been disabled, Secrets Manager returns null. If rotation fails, Secrets Manager retries the entire rotation process multiple times. If rotation is unsuccessful, this date may be in the past.
This date represents the latest date that rotation will occur, but it is not an approximate rotation date. In some cases, for example if you turn off automatic rotation and then turn it back on, the next rotation may occur much sooner than this date.
Tags (list) --
The list of tags attached to the secret. To add tags to a secret, use TagResource. To remove tags, use UntagResource.
(dict) --
A structure that contains information about a tag.
Key (string) --
The key identifier, or name, of the tag.
Value (string) --
The string value associated with the key of the tag.
VersionIdsToStages (dict) --
A list of the versions of the secret that have staging labels attached. Versions that don't have staging labels are considered deprecated and Secrets Manager can delete them.
Secrets Manager uses staging labels to indicate the status of a secret version during rotation. The three staging labels for rotation are:
AWSCURRENT, which indicates the current version of the secret.
AWSPENDING, which indicates the version of the secret that contains new secret information that will become the next current version when rotation finishes. During rotation, Secrets Manager creates an AWSPENDING version ID before creating the new secret version. To check if a secret version exists, call GetSecretValue.
AWSPREVIOUS, which indicates the previous current version of the secret. You can use this as the last known good version.
For more information about rotation and staging labels, see How rotation works.
(string) --
(list) --
(string) --
OwningService (string) --
The ID of the service that created this secret. For more information, see Secrets managed by other Amazon Web Services services.
CreatedDate (datetime) --
The date the secret was created.
PrimaryRegion (string) --
The Region the secret is in. If a secret is replicated to other Regions, the replicas are listed in ReplicationStatus.
ReplicationStatus (list) --
A list of the replicas of this secret and their status:
Failed, which indicates that the replica was not created.
InProgress, which indicates that Secrets Manager is in the process of creating the replica.
InSync, which indicates that the replica was created.
(dict) --
A replication object consisting of a RegionReplicationStatus object and includes a Region, KMSKeyId, status, and status message.
Region (string) --
The Region where replication occurs.
KmsKeyId (string) --
Can be an ARN, Key ID, or Alias.
Status (string) --
The status can be InProgress, Failed, or InSync.
StatusMessage (string) --
Status message such as "Secret with this name already exists in this region".
LastAccessedDate (datetime) --
The date that the secret was last accessed in the Region. This field is omitted if the secret has never been retrieved in the Region.
CrossAccountPrimary (dict) --
Information about the primary secret in the other Amazon Web Services account that this cross-account replica secret replicates from, including the primary secret ARN and the replication status. This field is omitted if the secret is not a cross-account replica.
PrimarySecretARN (string) --
The ARN of the primary secret replicating into this replica secret.
ReplicationStatus (string) --
The status of replication from the primary secret to this replica. The status can be:
InSync: Replication to the replica secret is complete.
Failed: Replication to the replica secret was unable to be completed.
InProgress: Replication to the replica secret has started but is not complete.
Pending: Replication has not yet started for the replica secret.
Detached: Replication to the replica secret was stopped by the primary.
StatusMessage (string) --
A message that describes the replication status, if Secrets Manager has more information to provide.
CrossAccountReplicas (list) --
A list of this secret's cross-account replica secrets and their replication status, if this secret is the primary for cross-account replication. This field is omitted if the secret has no cross-account replicas.
(dict) --
Information about a cross-account replica secret. This information is only available for cross-account primary secrets.
ReplicaSecretARN (string) --
The ARN of the replica secret.
ReplicationRoleARN (string) --
The ARN of the IAM role that Secrets Manager assumes to replicate to this replica, if one was specified when the replica was associated.
ReplicationStatus (string) --
The status of replication from this primary secret. The status can be:
InSync: Replication from the primary secret is complete.
Failed: Replication from the primary secret was unable to be completed.
InProgress: Replication from the primary secret has started but is not complete.
Detached: Replication from the primary secret was stopped by the replica.
StatusMessage (string) --
A message that describes the replication status, if Secrets Manager has more information to provide.
{'PolicyName': 'string'}
Retrieves the JSON text of the resource-based policy document attached to the secret. For more information about permissions policies attached to a secret, see Permissions policies attached to a secret.
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:GetResourcePolicy. For more information, see IAM policy actions for Secrets Manager and Authentication and access control in Secrets Manager.
See also: AWS API Documentation
Request Syntax
client.get_resource_policy(
SecretId='string',
PolicyName='string'
)
string
[REQUIRED]
The ARN or name of the secret to retrieve the attached resource-based policy for.
For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See Finding a secret from a partial ARN.
string
The name of the resource policy to retrieve. If you don't specify this field, Secrets Manager uses default. If you specify a name other than default and no policy with that name exists, the operation returns a ResourceNotFoundException.
dict
Response Syntax
{
'ARN': 'string',
'Name': 'string',
'ResourcePolicy': 'string',
'PolicyName': 'string'
}
Response Structure
(dict) --
ARN (string) --
The ARN of the secret that the resource-based policy was retrieved for.
Name (string) --
The name of the secret that the resource-based policy was retrieved for.
ResourcePolicy (string) --
A JSON-formatted string that contains the permissions policy attached to the secret. For more information about permissions policies, see Authentication and access control for Secrets Manager.
PolicyName (string) --
The name of the resource policy. If you didn't specify PolicyName in the request, this is default.
{'PolicyName': 'string'}
Attaches a resource-based permission policy to a secret. A resource-based policy is optional. For more information, see Authentication and access control for Secrets Manager
For information about attaching a policy in the console, see Attach a permissions policy to a secret.
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:PutResourcePolicy. For more information, see IAM policy actions for Secrets Manager and Authentication and access control in Secrets Manager.
See also: AWS API Documentation
Request Syntax
client.put_resource_policy(
SecretId='string',
ResourcePolicy='string',
PolicyName='string',
BlockPublicPolicy=True|False
)
string
[REQUIRED]
The ARN or name of the secret to attach the resource-based policy.
For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See Finding a secret from a partial ARN.
string
[REQUIRED]
A JSON-formatted string for an Amazon Web Services resource-based policy. For example policies, see Permissions policy examples.
string
The name of the resource policy to attach. If you don't specify this field, Secrets Manager uses default. You can only attach the default policy; if you specify any other name, the operation returns an InvalidParameterException.
boolean
Specifies whether to block resource-based policies that allow broad access to the secret, for example those that use a wildcard for the principal. By default, public policies aren't blocked.
dict
Response Syntax
{
'ARN': 'string',
'Name': 'string',
'PolicyName': 'string'
}
Response Structure
(dict) --
ARN (string) --
The ARN of the secret.
Name (string) --
The name of the secret.
PolicyName (string) --
The name of the resource policy. If you didn't specify PolicyName in the request, this is default.
{'ReplicationStatus': {'Status': {'Pending', 'Detached'}}}
For a secret that is replicated to other Regions, deletes the secret replicas from the Regions you specify.
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:RemoveRegionsFromReplication. For more information, see IAM policy actions for Secrets Manager and Authentication and access control in Secrets Manager.
See also: AWS API Documentation
Request Syntax
client.remove_regions_from_replication(
SecretId='string',
RemoveReplicaRegions=[
'string',
]
)
string
[REQUIRED]
The ARN or name of the secret.
list
[REQUIRED]
The Regions of the replicas to remove.
(string) --
dict
Response Syntax
{
'ARN': 'string',
'ReplicationStatus': [
{
'Region': 'string',
'KmsKeyId': 'string',
'Status': 'InSync'|'Failed'|'InProgress'|'Pending'|'Detached',
'StatusMessage': 'string',
'LastAccessedDate': datetime(2015, 1, 1)
},
]
}
Response Structure
(dict) --
ARN (string) --
The ARN of the primary secret.
ReplicationStatus (list) --
The status of replicas for this secret after you remove Regions.
(dict) --
A replication object consisting of a RegionReplicationStatus object and includes a Region, KMSKeyId, status, and status message.
Region (string) --
The Region where replication occurs.
KmsKeyId (string) --
Can be an ARN, Key ID, or Alias.
Status (string) --
The status can be InProgress, Failed, or InSync.
StatusMessage (string) --
Status message such as "Secret with this name already exists in this region".
LastAccessedDate (datetime) --
The date that the secret was last accessed in the Region. This field is omitted if the secret has never been retrieved in the Region.
{'ReplicationStatus': {'Status': {'Pending', 'Detached'}}}
Replicates the secret to a new Regions. See Multi-Region secrets.
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:ReplicateSecretToRegions. If the primary secret is encrypted with a KMS key other than aws/secretsmanager, you also need kms:Decrypt permission to the key. To encrypt the replicated secret with a KMS key other than aws/secretsmanager, you need kms:GenerateDataKey and kms:Encrypt to the key. For more information, see IAM policy actions for Secrets Manager and Authentication and access control in Secrets Manager.
See also: AWS API Documentation
Request Syntax
client.replicate_secret_to_regions(
SecretId='string',
AddReplicaRegions=[
{
'Region': 'string',
'KmsKeyId': 'string'
},
],
ForceOverwriteReplicaSecret=True|False
)
string
[REQUIRED]
The ARN or name of the secret to replicate.
list
[REQUIRED]
A list of Regions in which to replicate the secret.
(dict) --
A custom type that specifies a Region and the KmsKeyId for a replica secret.
Region (string) --
A Region code. For a list of Region codes, see Name and code of Regions.
KmsKeyId (string) --
The ARN, key ID, or alias of the KMS key to encrypt the secret. If you don't include this field, Secrets Manager uses aws/secretsmanager.
boolean
Specifies whether to overwrite a secret with the same name in the destination Region. By default, secrets aren't overwritten.
dict
Response Syntax
{
'ARN': 'string',
'ReplicationStatus': [
{
'Region': 'string',
'KmsKeyId': 'string',
'Status': 'InSync'|'Failed'|'InProgress'|'Pending'|'Detached',
'StatusMessage': 'string',
'LastAccessedDate': datetime(2015, 1, 1)
},
]
}
Response Structure
(dict) --
ARN (string) --
The ARN of the primary secret.
ReplicationStatus (list) --
The status of replication.
(dict) --
A replication object consisting of a RegionReplicationStatus object and includes a Region, KMSKeyId, status, and status message.
Region (string) --
The Region where replication occurs.
KmsKeyId (string) --
Can be an ARN, Key ID, or Alias.
Status (string) --
The status can be InProgress, Failed, or InSync.
StatusMessage (string) --
Status message such as "Secret with this name already exists in this region".
LastAccessedDate (datetime) --
The date that the secret was last accessed in the Region. This field is omitted if the secret has never been retrieved in the Region.