Skip to content

Secrets Manager  >  Operations  >  batch_get_secret_value

batch_get_secret_value

Operation

batch_get_secret_value async

batch_get_secret_value(input: BatchGetSecretValueInput, plugins: list[Plugin] | None = None) -> BatchGetSecretValueOutput

Retrieves the contents of the encrypted fields SecretString or SecretBinary for up to 20 secrets. To retrieve a single secret, call GetSecretValue.

To choose which secrets to retrieve, you can specify a list of secrets by name or ARN, or you can use filters. If Secrets Manager encounters errors such as AccessDeniedException while attempting to retrieve any of the secrets, you can see the errors in Errors in the response.

Secrets Manager generates CloudTrail GetSecretValue log entries for each secret you request 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:BatchGetSecretValue, and you must have secretsmanager:GetSecretValue for each secret. If you use filters, you must also have secretsmanager:ListSecrets. If the secrets are encrypted using customer-managed keys instead of the Amazon Web Services managed key aws/secretsmanager, then you also need kms:Decrypt permissions for the keys. For more information, see IAM policy actions for Secrets Manager and Authentication and access control in Secrets Manager.

Parameters:

Name Type Description Default
input BatchGetSecretValueInput

An instance of BatchGetSecretValueInput.

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
BatchGetSecretValueOutput

An instance of BatchGetSecretValueOutput.

Input

BatchGetSecretValueInput dataclass

Dataclass for BatchGetSecretValueInput structure.

Attributes

filters class-attribute instance-attribute
filters: list[Filter] | None = None

The filters to choose which secrets to retrieve. You must include Filters or SecretIdList, but not both.

max_results class-attribute instance-attribute
max_results: int | None = None

The number of results to include in the response.

If there are more results available, in the response, Secrets Manager includes NextToken. To get the next results, call BatchGetSecretValue again with the value from NextToken. To use this parameter, you must also use the Filters parameter.

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

A token that indicates where the output should continue from, if a previous call did not show all results. To get the next results, call BatchGetSecretValue again with this value.

secret_id_list class-attribute instance-attribute
secret_id_list: list[str] | None = None

The ARN or names of the secrets to retrieve. You must include Filters or SecretIdList, but not both.

Output

BatchGetSecretValueOutput dataclass

Dataclass for BatchGetSecretValueOutput structure.

Attributes

errors class-attribute instance-attribute
errors: list[APIErrorType] | None = None

A list of errors Secrets Manager encountered while attempting to retrieve individual secrets.

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

Secrets Manager includes this value if there's more output available than what is included in the current response. This can occur even when the response includes no values at all, such as when you ask for a filtered view of a long list. To get the next results, call BatchGetSecretValue again with this value.

secret_values class-attribute instance-attribute
secret_values: list[SecretValueEntry] | None = None

A list of secret values.