AWS Secrets Manager

2021/03/03 - AWS Secrets Manager - 3 new 3 updated api methods

Changes  Added support for multi-Region secrets APIs ReplicateSecretToRegions, RemoveRegionsFromReplication, and StopReplicationToReplica

ReplicateSecretToRegions (new) Link ¶

Converts an existing secret to a multi-Region secret and begins replication the secret to a list of new regions.

See also: AWS API Documentation

Request Syntax

client.replicate_secret_to_regions(
    SecretId='string',
    AddReplicaRegions=[
        {
            'Region': 'string',
            'KmsKeyId': 'string'
        },
    ],
    ForceOverwriteReplicaSecret=True|False
)
type SecretId

string

param SecretId

[REQUIRED]

Use the Secret Id to replicate a secret to regions.

type AddReplicaRegions

list

param AddReplicaRegions

[REQUIRED]

Add Regions to replicate the secret.

  • (dict) --

    (Optional) Custom type consisting of a Region (required) and the KmsKeyId which can be an ARN , Key ID , or Alias .

    • Region (string) --

      Describes a single instance of Region objects.

    • KmsKeyId (string) --

      Can be an ARN , Key ID , or Alias .

type ForceOverwriteReplicaSecret

boolean

param ForceOverwriteReplicaSecret

(Optional) If set, Secrets Manager replication overwrites a secret with the same name in the destination region.

rtype

dict

returns

Response Syntax

{
    'ARN': 'string',
    'ReplicationStatus': [
        {
            'Region': 'string',
            'KmsKeyId': 'string',
            'Status': 'InSync'|'Failed'|'InProgress',
            'StatusMessage': 'string',
            'LastAccessedDate': datetime(2015, 1, 1)
        },
    ]
}

Response Structure

  • (dict) --

    • ARN (string) --

      Replicate a secret based on the ReplicaRegionType > consisting of a Region(required) and a KMSKeyId (optional) which can be the ARN, KeyID, or Alias.

    • ReplicationStatus (list) --

      Describes the secret replication status as PENDING , SUCCESS or FAIL .

      • (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 you last accessed the secret in the Region.

RemoveRegionsFromReplication (new) Link ¶

Remove regions from replication.

See also: AWS API Documentation

Request Syntax

client.remove_regions_from_replication(
    SecretId='string',
    RemoveReplicaRegions=[
        'string',
    ]
)
type SecretId

string

param SecretId

[REQUIRED]

Remove a secret by SecretId from replica Regions.

type RemoveReplicaRegions

list

param RemoveReplicaRegions

[REQUIRED]

Remove replication from specific Regions.

  • (string) --

rtype

dict

returns

Response Syntax

{
    'ARN': 'string',
    'ReplicationStatus': [
        {
            'Region': 'string',
            'KmsKeyId': 'string',
            'Status': 'InSync'|'Failed'|'InProgress',
            'StatusMessage': 'string',
            'LastAccessedDate': datetime(2015, 1, 1)
        },
    ]
}

Response Structure

  • (dict) --

    • ARN (string) --

      The secret ARN removed from replication regions.

    • ReplicationStatus (list) --

      Describes the remaining replication status after you remove regions from the replication list.

      • (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 you last accessed the secret in the Region.

StopReplicationToReplica (new) Link ¶

Removes the secret from replication and promotes the secret to a regional secret in the replica Region.

See also: AWS API Documentation

Request Syntax

client.stop_replication_to_replica(
    SecretId='string'
)
type SecretId

string

param SecretId

[REQUIRED]

Response to StopReplicationToReplica of a secret, based on the SecretId .

rtype

dict

returns

Response Syntax

{
    'ARN': 'string'
}

Response Structure

  • (dict) --

    • ARN (string) --

      Response StopReplicationToReplica of a secret, based on the ARN, .

CreateSecret (updated) Link ¶
Changes (request, response)
Request
{'AddReplicaRegions': [{'KmsKeyId': 'string', 'Region': 'string'}],
 'ForceOverwriteReplicaSecret': 'boolean'}
Response
{'ReplicationStatus': [{'KmsKeyId': 'string',
                        'LastAccessedDate': 'timestamp',
                        'Region': 'string',
                        'Status': 'InSync | Failed | InProgress',
                        'StatusMessage': 'string'}]}

Creates a new secret. A secret in Secrets Manager consists of both the protected secret data and the important information needed to manage the secret.

Secrets Manager stores the encrypted secret data in one of a collection of "versions" associated with the secret. Each version contains a copy of the encrypted secret data. Each version is associated with one or more "staging labels" that identify where the version is in the rotation cycle. The SecretVersionsToStages field of the secret contains the mapping of staging labels to the active versions of the secret. Versions without a staging label are considered deprecated and not included in the list.

You provide the secret data to be encrypted by putting text in either the SecretString parameter or binary data in the SecretBinary parameter, but not both. If you include SecretString or SecretBinary then Secrets Manager also creates an initial secret version and automatically attaches the staging label AWSCURRENT to the new version.

Note

  • If you call an operation to encrypt or decrypt the SecretString or SecretBinary for a secret in the same account as the calling user and that secret doesn't specify a AWS KMS encryption key, Secrets Manager uses the account's default AWS managed customer master key (CMK) with the alias 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 same AWS account automatically have access to use the default CMK. Note that if an Secrets Manager API call results in AWS creating the account's AWS-managed CMK, it can result in a one-time significant delay in returning the result.

  • If the secret resides in a different AWS account from the credentials calling an API that requires encryption or decryption of the secret value then you must create and use a custom AWS KMS CMK because you can't access the default CMK for the account using credentials from a different AWS account. Store the ARN of the CMK in the secret when you create the secret or when you update it by including it in the KMSKeyId . If you call an API that must encrypt or decrypt SecretString or SecretBinary using credentials from a different account then the AWS KMS key policy must grant cross-account access to that other account's user or role for both the kms:GenerateDataKey and kms:Decrypt operations.

Minimum permissions

To run this command, you must have the following permissions:

  • secretsmanager:CreateSecret

  • kms:GenerateDataKey - needed only if you use a customer-managed AWS KMS key to encrypt the secret. You do not need this permission to use the account default AWS managed CMK for Secrets Manager.

  • kms:Decrypt - needed only if you use a customer-managed AWS KMS key to encrypt the secret. You do not need this permission to use the account default AWS managed CMK for Secrets Manager.

  • secretsmanager:TagResource - needed only if you include the Tags parameter.

Related operations

  • To delete a secret, use DeleteSecret.

  • To modify an existing secret, use UpdateSecret.

  • To create a new version of a secret, use PutSecretValue.

  • To retrieve the encrypted secure string and secure binary values, use GetSecretValue.

  • To retrieve all other details for a secret, use DescribeSecret. This does not include the encrypted secure string and secure binary values.

  • To retrieve the list of secret versions associated with the current secret, use DescribeSecret and examine the SecretVersionsToStages response value.

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 Name

string

param Name

[REQUIRED]

Specifies the friendly name of the new secret.

The secret name must be ASCII letters, digits, or the following characters : /_+=.@-

Note

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 at the end of the ARN.

type ClientRequestToken

string

param ClientRequestToken

(Optional) If you include SecretString or SecretBinary , then an initial version is created as part of the secret, and this parameter specifies a unique identifier for the new version.

Note

If you use the AWS CLI or one of the AWS SDK to call this operation, then you can leave this parameter empty. The CLI or SDK generates a random UUID for you and includes it as the value for this parameter in the request. If you don't use the SDK and instead generate a raw HTTP request to the Secrets Manager service endpoint, then you must generate a ClientRequestToken yourself for the new version and include the value 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.

type Description

string

param Description

(Optional) Specifies a user-provided description of the secret.

type KmsKeyId

string

param KmsKeyId

(Optional) Specifies the ARN, Key ID, or alias of the AWS KMS customer master key (CMK) to be used to encrypt the SecretString or SecretBinary values in the versions stored in this secret.

You can specify any of the supported ways to identify a AWS KMS key ID. If you need to reference a CMK in a different account, you can use only the key ARN or the alias ARN.

If you don't specify this value, then Secrets Manager defaults to using the AWS account's default CMK (the one named aws/secretsmanager ). If a AWS KMS CMK with that name doesn't yet exist, then Secrets Manager creates it for you automatically the first time it needs to encrypt a version's SecretString or SecretBinary fields.

Warning

You can use the account default CMK to encrypt and decrypt only if you call this operation using credentials from the same account that owns the secret. If the secret resides in a different account, then you must create a custom CMK and specify the ARN in this field.

type SecretBinary

bytes

param SecretBinary

(Optional) Specifies binary data that you want to encrypt and store in the new version of the secret. To use this parameter in the command-line tools, we recommend that you store your binary data in a file and then use the appropriate technique for your tool to pass the contents of the file as a parameter.

Either SecretString or SecretBinary must have a value, but not both. They cannot both be empty.

This parameter is not available using the Secrets Manager console. It can be accessed only by using the AWS CLI or one of the AWS SDKs.

type SecretString

string

param SecretString

(Optional) Specifies text data that you want to encrypt and store in this new version of the secret.

Either SecretString or SecretBinary must have a value, but not both. They cannot both be empty.

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 the Lambda rotation function knows how to parse.

For storing multiple values, we recommend that you use a JSON text string argument and specify key/value pairs. For information on how to format a JSON parameter for the various command line tool environments, see Using JSON for Parameters in the AWS CLI User Guide . For example:

{"username":"bob","password":"abc123xyz456"}

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.

type Tags

list

param Tags

(Optional) Specifies a list of user-defined tags that are attached to the secret. Each tag is a "Key" and "Value" pair of strings. This operation only appends tags to the existing list of tags. To remove tags, you must use UntagResource.

Warning

  • 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 IAM policy Condition elements as part of your security strategy, then adding or removing a tag can change permissions. If the successful completion of this operation would result in you losing your permissions for this secret, then this operation is blocked and returns an Access Denied error.

This parameter requires a JSON text string argument. For information on how to format a JSON parameter for the various command line tool environments, see Using JSON for Parameters in the AWS CLI User Guide . For example:

[{"Key":"CostCenter","Value":"12345"},{"Key":"environment","Value":"production"}]

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.

The following basic restrictions apply to tags:

  • Maximum number of tags per secret—50

  • Maximum key length—127 Unicode characters in UTF-8

  • Maximum value length—255 Unicode characters in UTF-8

  • Tag keys and values are case sensitive.

  • Do not use the aws: prefix in your tag names or values because AWS reserves it for AWS use. You can't edit or delete tag names or values with this prefix. Tags with this prefix do not count against your tags per secret limit.

  • If you use your tagging schema across multiple services and resources, remember other services might have restrictions on allowed characters. Generally allowed characters: letters, spaces, and numbers representable in UTF-8, plus the following special characters: + - = . _ : / @.

  • (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.

type AddReplicaRegions

list

param AddReplicaRegions

(Optional) Add a list of regions to replicate secrets. Secrets Manager replicates the KMSKeyID objects to the list of regions specified in the parameter.

  • (dict) --

    (Optional) Custom type consisting of a Region (required) and the KmsKeyId which can be an ARN , Key ID , or Alias .

    • Region (string) --

      Describes a single instance of Region objects.

    • KmsKeyId (string) --

      Can be an ARN , Key ID , or Alias .

type ForceOverwriteReplicaSecret

boolean

param ForceOverwriteReplicaSecret

(Optional) If set, the replication overwrites a secret with the same name in the destination region.

rtype

dict

returns

Response Syntax

{
    'ARN': 'string',
    'Name': 'string',
    'VersionId': 'string',
    'ReplicationStatus': [
        {
            'Region': 'string',
            'KmsKeyId': 'string',
            'Status': 'InSync'|'Failed'|'InProgress',
            'StatusMessage': 'string',
            'LastAccessedDate': datetime(2015, 1, 1)
        },
    ]
}

Response Structure

  • (dict) --

    • ARN (string) --

      The Amazon Resource Name (ARN) of the secret that you just created.

      Note

      Secrets Manager automatically adds several random characters to the name at the end of the ARN when you initially create a secret. This affects only the ARN and not the actual friendly name. This ensures that if you create a new secret with the same name as an old secret that you previously deleted, then users with access to the old secret don't automatically get access to the new secret because the ARNs are different.

    • Name (string) --

      The friendly name of the secret that you just created.

    • VersionId (string) --

      The unique identifier associated with the version of the secret you just created.

    • ReplicationStatus (list) --

      Describes a list of replication status objects as InProgress , Failed or InSync .

      • (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 you last accessed the secret in the Region.

DescribeSecret (updated) Link ¶
Changes (response)
{'PrimaryRegion': 'string',
 'ReplicationStatus': [{'KmsKeyId': 'string',
                        'LastAccessedDate': 'timestamp',
                        'Region': 'string',
                        'Status': 'InSync | Failed | InProgress',
                        'StatusMessage': 'string'}]}

Retrieves the details of a secret. It does not include the encrypted fields. Secrets Manager only returns fields populated with a value in the response.

Minimum permissions

To run this command, you must have the following permissions:

  • secretsmanager:DescribeSecret

Related operations

  • To create a secret, use CreateSecret.

  • To modify a secret, use UpdateSecret.

  • To retrieve the encrypted secret information in a version of the secret, use GetSecretValue.

  • To list all of the secrets in the AWS account, use ListSecrets.

See also: AWS API Documentation

Request Syntax

client.describe_secret(
    SecretId='string'
)
type SecretId

string

param SecretId

[REQUIRED]

The identifier of the secret whose details you want to retrieve. You can specify either the Amazon Resource Name (ARN) or the friendly name of the secret.

Note

If you specify an ARN, we generally recommend that you specify a complete ARN. You can specify a partial ARN too—for example, if you don’t include the final hyphen and six random characters that Secrets Manager adds at the end of the ARN when you created the secret. A partial ARN match can work as long as it uniquely matches only one secret. However, if your secret has a name that ends in a hyphen followed by six characters (before Secrets Manager adds the hyphen and six characters to the ARN) and you try to use that as a partial ARN, then those characters cause Secrets Manager to assume that you’re specifying a complete ARN. This confusion can cause unexpected results. To avoid this situation, we recommend that you don’t create secret names ending with a hyphen followed by six characters.

If you specify an incomplete ARN without the random suffix, and instead provide the 'friendly name', you must not include the random suffix. If you do include the random suffix added by Secrets Manager, you receive either a ResourceNotFoundException or an AccessDeniedException error, depending on your permissions.

rtype

dict

returns

Response Syntax

{
    'ARN': 'string',
    'Name': 'string',
    'Description': 'string',
    'KmsKeyId': 'string',
    'RotationEnabled': True|False,
    'RotationLambdaARN': 'string',
    'RotationRules': {
        'AutomaticallyAfterDays': 123
    },
    'LastRotatedDate': datetime(2015, 1, 1),
    'LastChangedDate': datetime(2015, 1, 1),
    'LastAccessedDate': datetime(2015, 1, 1),
    'DeletedDate': 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',
            'StatusMessage': 'string',
            'LastAccessedDate': datetime(2015, 1, 1)
        },
    ]
}

Response Structure

  • (dict) --

    • ARN (string) --

      The ARN of the secret.

    • Name (string) --

      The user-provided friendly name of the secret.

    • Description (string) --

      The user-provided description of the secret.

    • KmsKeyId (string) --

      The ARN or alias of the AWS KMS customer master key (CMK) that's used to encrypt the SecretString or SecretBinary fields in each version of the secret. If you don't provide a key, then Secrets Manager defaults to encrypting the secret fields with the default AWS KMS CMK (the one named awssecretsmanager ) for this account.

    • RotationEnabled (boolean) --

      Specifies whether automatic rotation is enabled for this secret.

      To enable rotation, use RotateSecret with AutomaticallyRotateAfterDays set to a value greater than 0. To disable rotation, use CancelRotateSecret.

    • RotationLambdaARN (string) --

      The ARN of a Lambda function that's invoked by Secrets Manager to rotate the secret either automatically per the schedule or manually by a call to RotateSecret .

    • RotationRules (dict) --

      A structure with the rotation configuration for this secret.

      • AutomaticallyAfterDays (integer) --

        Specifies the number of days between automatic scheduled rotations of the secret.

        Secrets Manager schedules the next rotation when the previous one is complete. Secrets Manager schedules the date by adding the rotation interval (number of days) to the actual date of the last rotation. The service chooses the hour within that 24-hour date window randomly. The minute is also chosen somewhat randomly, but weighted towards the top of the hour and influenced by a variety of factors that help distribute load.

    • LastRotatedDate (datetime) --

      The last date and time that the rotation process for this secret was invoked.

      The most recent date and time that the Secrets Manager rotation process successfully completed. If the secret doesn't rotate, Secrets Manager returns a null value.

    • LastChangedDate (datetime) --

      The last date and time that this secret was modified in any way.

    • LastAccessedDate (datetime) --

      The last date that this secret was accessed. This value is truncated to midnight of the date and therefore shows only the date, not the time.

    • DeletedDate (datetime) --

      This value exists if the secret is scheduled for deletion. Some time after the specified date and time, Secrets Manager deletes the secret and all of its versions.

      If a secret is scheduled for deletion, then its details, including the encrypted secret information, is not accessible. To cancel a scheduled deletion and restore access, use RestoreSecret.

    • Tags (list) --

      The list of user-defined tags that are associated with 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 all of the currently assigned VersionStage staging labels and the VersionId that each is attached to. Staging labels are used to keep track of the different versions during the rotation process.

      Note

      A version that does not have any staging labels attached is considered deprecated and subject to deletion. Such versions are not included in this list.

      • (string) --

        • (list) --

          • (string) --

    • OwningService (string) --

      Returns the name of the service that created this secret.

    • CreatedDate (datetime) --

      The date you created the secret.

    • PrimaryRegion (string) --

      Specifies the primary region for secret replication.

    • ReplicationStatus (list) --

      Describes a list of replication status objects as InProgress , Failed or InSync . P

      • (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 you last accessed the secret in the Region.

ListSecrets (updated) Link ¶
Changes (request, response)
Request
{'Filters': {'Key': {'primary-region'}}}
Response
{'SecretList': {'PrimaryRegion': 'string'}}

Lists all of the secrets that are stored by Secrets Manager in the AWS account. To list the versions currently stored for a specific secret, use ListSecretVersionIds. The encrypted fields SecretString and SecretBinary are not included in the output. To get that information, call the GetSecretValue operation.

Note

Always check the NextToken response parameter when calling any of the List* operations. These operations can occasionally return an empty or shorter than expected list of results even when there more results become available. When this happens, the NextToken response parameter contains a value to pass to the next call to the same API to request the next part of the list.

Minimum permissions

To run this command, you must have the following permissions:

  • secretsmanager:ListSecrets

Related operations

  • To list the versions attached to a secret, use ListSecretVersionIds.

See also: AWS API Documentation

Request Syntax

client.list_secrets(
    MaxResults=123,
    NextToken='string',
    Filters=[
        {
            'Key': 'description'|'name'|'tag-key'|'tag-value'|'primary-region'|'all',
            'Values': [
                'string',
            ]
        },
    ],
    SortOrder='asc'|'desc'
)
type MaxResults

integer

param MaxResults

(Optional) Limits the number of results you want to include in the response. If you don't include this parameter, it defaults to a value that's specific to the operation. If additional items exist beyond the maximum you specify, the NextToken response element is present and has a value (isn't null). Include that value as the NextToken request parameter in the next call to the operation to get the next part of the results. Note that Secrets Manager might return fewer results than the maximum even when there are more results available. You should check NextToken after every operation to ensure that you receive all of the results.

type NextToken

string

param NextToken

(Optional) Use this parameter in a request if you receive a NextToken response in a previous request indicating there's more output available. In a subsequent call, set it to the value of the previous call NextToken response to indicate where the output should continue from.

type Filters

list

param Filters

Lists the secret request filters.

  • (dict) --

    Allows you to add filters when you use the search function in Secrets Manager.

    • Key (string) --

      Filters your list of secrets by a specific key.

    • Values (list) --

      Filters your list of secrets by a specific value.

      You can prefix your search value with an exclamation mark ( ! ) in order to perform negation filters.

      • (string) --

type SortOrder

string

param SortOrder

Lists secrets in the requested order.

rtype

dict

returns

Response Syntax

{
    'SecretList': [
        {
            'ARN': 'string',
            'Name': 'string',
            'Description': 'string',
            'KmsKeyId': 'string',
            'RotationEnabled': True|False,
            'RotationLambdaARN': 'string',
            'RotationRules': {
                'AutomaticallyAfterDays': 123
            },
            'LastRotatedDate': datetime(2015, 1, 1),
            'LastChangedDate': datetime(2015, 1, 1),
            'LastAccessedDate': datetime(2015, 1, 1),
            'DeletedDate': datetime(2015, 1, 1),
            'Tags': [
                {
                    'Key': 'string',
                    'Value': 'string'
                },
            ],
            'SecretVersionsToStages': {
                'string': [
                    'string',
                ]
            },
            'OwningService': 'string',
            'CreatedDate': datetime(2015, 1, 1),
            'PrimaryRegion': 'string'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • SecretList (list) --

      A list of the secrets in the account.

      • (dict) --

        A structure that contains the details about a secret. It does not include the encrypted SecretString and SecretBinary values. To get those values, use the GetSecretValue operation.

        • ARN (string) --

          The Amazon Resource Name (ARN) of the secret.

          For more information about ARNs in Secrets Manager, see Policy Resources in the AWS Secrets Manager User Guide .

        • Name (string) --

          The friendly name of the secret. You can use forward slashes in the name to represent a path hierarchy. For example, /prod/databases/dbserver1 could represent the secret for a server named dbserver1 in the folder databases in the folder prod .

        • Description (string) --

          The user-provided description of the secret.

        • KmsKeyId (string) --

          The ARN or alias of the AWS KMS customer master key (CMK) used to encrypt the SecretString and SecretBinary fields in each version of the secret. If you don't provide a key, then Secrets Manager defaults to encrypting the secret fields with the default KMS CMK, the key named awssecretsmanager , for this account.

        • RotationEnabled (boolean) --

          Indicates whether automatic, scheduled rotation is enabled for this secret.

        • RotationLambdaARN (string) --

          The ARN of an AWS Lambda function invoked by Secrets Manager to rotate and expire the secret either automatically per the schedule or manually by a call to RotateSecret.

        • RotationRules (dict) --

          A structure that defines the rotation configuration for the secret.

          • AutomaticallyAfterDays (integer) --

            Specifies the number of days between automatic scheduled rotations of the secret.

            Secrets Manager schedules the next rotation when the previous one is complete. Secrets Manager schedules the date by adding the rotation interval (number of days) to the actual date of the last rotation. The service chooses the hour within that 24-hour date window randomly. The minute is also chosen somewhat randomly, but weighted towards the top of the hour and influenced by a variety of factors that help distribute load.

        • LastRotatedDate (datetime) --

          The most recent date and time that the Secrets Manager rotation process was successfully completed. This value is null if the secret hasn't ever rotated.

        • LastChangedDate (datetime) --

          The last date and time that this secret was modified in any way.

        • LastAccessedDate (datetime) --

          The last date that this secret was accessed. This value is truncated to midnight of the date and therefore shows only the date, not the time.

        • DeletedDate (datetime) --

          The date and time the deletion of the secret occurred. Not present on active secrets. The secret can be recovered until the number of days in the recovery window has passed, as specified in the RecoveryWindowInDays parameter of the DeleteSecret operation.

        • Tags (list) --

          The list of user-defined tags associated with 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.

        • SecretVersionsToStages (dict) --

          A list of all of the currently assigned SecretVersionStage staging labels and the SecretVersionId attached to each one. Staging labels are used to keep track of the different versions during the rotation process.

          Note

          A version that does not have any SecretVersionStage is considered deprecated and subject to deletion. Such versions are not included in this list.

          • (string) --

            • (list) --

              • (string) --

        • OwningService (string) --

          Returns the name of the service that created the secret.

        • CreatedDate (datetime) --

          The date and time when a secret was created.

        • PrimaryRegion (string) --

          The Region where Secrets Manager originated the secret.

    • NextToken (string) --

      If present in the response, this value indicates that there's more output available than included in the current response. This can occur even when the response includes no values at all, such as when you ask for a filtered view of a very long list. Use this value in the NextToken request parameter in a subsequent call to the operation to continue processing and get the next part of the output. You should repeat this until the NextToken response element comes back empty (as null ).