Skip to content

describe_secret

Operation

describe_secret

describe_secret(request: DescribeSecretInput | DescribeSecretInputDict | None = None, /, *, plugins: list[Plugin] | None = None, **kwargs: Unpack[DescribeSecretInputDict]) -> 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.

Note

The VersionIdsToStages field in the response includes every version ID that has a staging label attached, even if that version doesn't contain a secret value. In contrast, ListSecretVersionIds only returns versions that contain a secret value. To check whether a secret version contains a value, call GetSecretValue.

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
request DescribeSecretInput | DescribeSecretInputDict | None

The input as a model or dictionary. Pass this or keyword arguments, not both.

None
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
**kwargs Unpack[DescribeSecretInputDict]

The input fields as keyword arguments.

{}

Returns:

Type Description
DescribeSecretOutput

An instance of DescribeSecretOutput.

describe_secret async

describe_secret(request: DescribeSecretInput | DescribeSecretInputDict | None = None, /, *, plugins: list[Plugin] | None = None, **kwargs: Unpack[DescribeSecretInputDict]) -> 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.

Note

The VersionIdsToStages field in the response includes every version ID that has a staging label attached, even if that version doesn't contain a secret value. In contrast, ListSecretVersionIds only returns versions that contain a secret value. To check whether a secret version contains a value, call GetSecretValue.

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
request DescribeSecretInput | DescribeSecretInputDict | None

The input as a model or dictionary. Pass this or keyword arguments, not both.

None
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
**kwargs Unpack[DescribeSecretInputDict]

The input fields as keyword arguments.

{}

Returns:

Type Description
DescribeSecretOutput

An instance of DescribeSecretOutput.

Input

Pass the input as keyword arguments, a positional dictionary, or a positional model object. Pass plugins separately as a keyword argument.

DescribeSecretInputDict

Bases: TypedDict

Dictionary form of DescribeSecretInput.

Attributes

secret_id instance-attribute
secret_id: Required[str]

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.

DescribeSecretInput dataclass

Bases: _SerdeShape

Dataclass for DescribeSecretInput structure.

Attributes

secret_id class-attribute instance-attribute
secret_id: str | 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

Bases: _SerdeShape

Dataclass for DescribeSecretOutput structure.

Attributes

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

The ARN of the secret.

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

The date the secret was created.

cross_account_primary class-attribute instance-attribute
cross_account_primary: CrossAccountPrimaryType | None = ...

Information about the primary secret in the other Amazon Web Services account that this cross-account replica secret replicates from, including the primary secret ARN and the replication status. This field is omitted if the secret is not a cross-account replica.

cross_account_replicas class-attribute instance-attribute
cross_account_replicas: list[CrossAccountReplicaEntry] | None = ...

A list of this secret's cross-account replica secrets and their replication status, if this secret is the primary for cross-account replication. This field is omitted if the secret has no cross-account replicas.

deleted_date class-attribute instance-attribute
deleted_date: datetime | 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 = ...

The description of the secret.

external_secret_rotation_metadata class-attribute instance-attribute
external_secret_rotation_metadata: list[ExternalSecretRotationMetadataItem] | 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 = ...

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

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

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

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

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

The name of the secret.

next_rotation_date class-attribute instance-attribute
next_rotation_date: datetime | 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 = ...

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

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

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.

response_metadata class-attribute instance-attribute
response_metadata: ResponseMetadata = ...

Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.

rotation_enabled class-attribute instance-attribute
rotation_enabled: bool | 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 = ...

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

rotation_rules class-attribute instance-attribute
rotation_rules: RotationRulesType | 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 = ...

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

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

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.