Skip to content

Secrets Manager  >  Operations  >  describe_secret

describe_secret

Operation

describe_secret async

describe_secret(input: DescribeSecretInput, plugins: list[Plugin] | None = None) -> DescribeSecretOutput

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.

Parameters:

Name Type Description Default
input DescribeSecretInput

An instance of DescribeSecretInput.

required
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
DescribeSecretOutput

An instance of DescribeSecretOutput.

Input

DescribeSecretInput dataclass

Dataclass for DescribeSecretInput structure.

Attributes

secret_id class-attribute instance-attribute
secret_id: str | None = None

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.

Output

DescribeSecretOutput dataclass

Dataclass for DescribeSecretOutput structure.

Attributes

arn class-attribute instance-attribute
arn: str | None = None

The ARN of the secret.

created_date class-attribute instance-attribute
created_date: datetime | None = None

The date the secret was created.

deleted_date class-attribute instance-attribute
deleted_date: datetime | None = None

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.

description class-attribute instance-attribute
description: str | None = None

The description of the secret.

external_secret_rotation_metadata class-attribute instance-attribute
external_secret_rotation_metadata: list[ExternalSecretRotationMetadataItem] | None = None

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.

external_secret_rotation_role_arn class-attribute instance-attribute
external_secret_rotation_role_arn: str | None = None

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.

kms_key_id class-attribute instance-attribute
kms_key_id: str | None = None

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.

last_accessed_date class-attribute instance-attribute
last_accessed_date: datetime | None = None

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.

last_changed_date class-attribute instance-attribute
last_changed_date: datetime | None = None

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

last_rotated_date class-attribute instance-attribute
last_rotated_date: datetime | None = None

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.

name class-attribute instance-attribute
name: str | None = None

The name of the secret.

next_rotation_date class-attribute instance-attribute
next_rotation_date: datetime | None = None

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.

owning_service class-attribute instance-attribute
owning_service: str | None = None

The ID of the service that created this secret. For more information, see Secrets managed by other Amazon Web Services services.

primary_region class-attribute instance-attribute
primary_region: str | None = None

The Region the secret is in. If a secret is replicated to other Regions, the replicas are listed in ReplicationStatus.

replication_status class-attribute instance-attribute
replication_status: list[ReplicationStatusType] | None = None

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.

rotation_enabled class-attribute instance-attribute
rotation_enabled: bool | None = None

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.

rotation_lambda_arn class-attribute instance-attribute
rotation_lambda_arn: str | None = None

The ARN of the Lambda function that Secrets Manager invokes to rotate the secret.

rotation_rules class-attribute instance-attribute
rotation_rules: RotationRulesType | None = None

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.

tags class-attribute instance-attribute
tags: list[Tag] | None = None

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

type class-attribute instance-attribute
type: str | None = None

The exact string that identifies the partner that holds the external secret. For more information, see Using Secrets Manager managed external secrets.

version_ids_to_stages class-attribute instance-attribute
version_ids_to_stages: dict[str, list[str]] | None = None

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.