[ 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 Amazon Web Services 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.

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 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 Amazon Web Services 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 Amazon Web Services 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 with the rotation configuration for this secret. This field is only populated if rotation is configured.

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

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