[ aws . secretsmanager ]

describe-secret

Description

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.

See also: AWS API Documentation

See ‘aws help’ for descriptions of global parameters.

Synopsis

  describe-secret
--secret-id <value>
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]

Options

--secret-id (string)

The ARN or name of the secret.

For an ARN, we recommend that you specify a complete ARN rather than a partial ARN.

--cli-input-json | --cli-input-yaml (string) Reads arguments from the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton. If other arguments are provided on the command line, those values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally. This may not be specified along with --cli-input-yaml.

--generate-cli-skeleton (string) Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input, prints a sample input JSON that can be used as an argument for --cli-input-json. Similarly, if provided yaml-input it will print a sample input YAML that can be used with --cli-input-yaml. If provided with the value output, it validates the command inputs and returns a sample output JSON for that command.

See ‘aws help’ for descriptions of global parameters.

Examples

To retrieve the details of a secret

The following describe-secret example shows the details of a secret.

aws secretsmanager describe-secret \
    --secret-id MyTestSecret

Output:

{
    "ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestSecret-Ca8JGt",
    "Name": "MyTestSecret",
    "Description": "My test secret",
    "KmsKeyId": "arn:aws:kms:us-west-2:123456789012:key/EXAMPLE1-90ab-cdef-fedc-ba987EXAMPLE",
    "RotationEnabled": true,
    "RotationLambdaARN": "arn:aws:lambda:us-west-2:123456789012:function:MyTestRotationLambda",
    "RotationRules": {
        "AutomaticallyAfterDays": 30
    },
    "LastRotatedDate": 1525747253.72,
    "LastChangedDate": 1523477145.729,
    "LastAccessedDate": 1524572133.25,
    "Tags": [
        {
            "Key": "SecondTag",
            "Value": "AnotherValue"
        },
        {
            "Key": "FirstTag",
            "Value": "SomeValue"
        }
    ],
    "VersionIdsToStages": {
        "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111": [
            "AWSPREVIOUS"
        ],
        "a1b2c3d4-5678-90ab-cdef-EXAMPLE22222": [
            "AWSCURRENT"
        ],
        "a1b2c3d4-5678-90ab-cdef-EXAMPLE33333": [
            "AWSPENDING"
        ]
    },
    "CreatedDate": 1521534252.66,
    "PrimaryRegion": "us-west-2",
    "ReplicationStatus": [
        {
            "Region": "eu-west-3",
            "KmsKeyId": "alias/aws/secretsmanager",
            "Status": "InSync",
            "StatusMessage": "Replication succeeded"
        }
    ]
}

For more information, see Secret in the Secrets Manager User Guide.

Output

ARN -> (string)

The ARN of the secret.

Name -> (string)

The name of the secret.

Description -> (string)

The description of the secret.

KmsKeyId -> (string)

The 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.

RotationEnabled -> (boolean)

Specifies whether automatic rotation is turned on for this secret.

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 -> (structure)

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 -> (long)

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 -> (timestamp)

The last date and time that Secrets Manager rotated the secret. If the secret isn’t configured for rotation, Secrets Manager returns null.

LastChangedDate -> (timestamp)

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

LastAccessedDate -> (timestamp)

The last date that the secret value was retrieved. This value does not include the time. This field is omitted if the secret has never been retrieved.

DeletedDate -> (timestamp)

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 .

Tags -> (list)

The list of tags attached to the secret. To add tags to a secret, use TagResource . To remove tags, use UntagResource .

(structure)

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 -> (map)

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 .

key -> (string)

value -> (list)

(string)

OwningService -> (string)

The name of the service that created this secret.

CreatedDate -> (timestamp)

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.

(structure)

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 -> (timestamp)

The date that you last accessed the secret in the Region.