[ aws . secretsmanager ]

describe-secret

Description

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

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

--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 example shows how to get the details about a secret.

aws secretsmanager describe-secret --secret-id MyTestDatabaseSecret

The output shows the following:

{
  "ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-Ca8JGt",
  "Name": "MyTestDatabaseSecret",
  "Description": "My test database secret",
  "LastChangedDate": 1523477145.729,
  "RotationEnabled": true
  "RotationLambdaARN": "arn:aws:lambda:us-west-2:123456789012:function:MyTestRotationLambda",
  "RotationRules": {
    "AutomaticallyAfterDays": 30
  },
  "LastRotatedDate": 1525747253.72
  "Tags": [
    {
      "Key": "SecondTag",
      "Value": "AnotherValue"
    },
    {
      "Key": "FirstTag",
      "Value": "SomeValue"
    }
  ],
  "VersionIdsToStages": {
    "EXAMPLE1-90ab-cdef-fedc-ba987EXAMPLE": [
      "AWSPREVIOUS"
    ],
    "EXAMPLE2-90ab-cdef-fedc-ba987EXAMPLE": [
      "AWSCURRENT"
    ]
  }
}

Output

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

A structure that contains the rotation configuration for this secret.

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 most recent date and time that the Secrets Manager rotation process was successfully completed. This value is null if the secret has never rotated.

LastChangedDate -> (timestamp)

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

LastAccessedDate -> (timestamp)

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

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 .

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

key -> (string)

value -> (list)

(string)

OwningService -> (string)

Returns the name of the service that created this secret.

CreatedDate -> (timestamp)

The date that the secret was created.