Returns a set of temporary security credentials that are scoped down from the caller’s existing temporary security credentials. GetScopedCredentials preserves the caller’s identity while narrowing the permissions and optionally shortening the session lifetime.
For a comparison of GetScopedCredentials with the other API operations that produce temporary security credentials, see Requesting Temporary Security Credentials and Compare STS credentials in the IAM User Guide.
Credential requirements
You can only call GetScopedCredentials with temporary security credentials, for example, credentials from an assumed role or a federated session. You cannot call it with IAM user credentials or root credentials. If you want to scope down IAM user credentials, first call GetSessionToken to get temporary security credentials, and then call GetScopedCredentials with those credentials.
GetScopedCredentials API is not available on the STS Global endpoint.See also: AWS API Documentation
get-scoped-credentials
[--policy <value>]
[--duration-seconds <value>]
[--minimum-session-token-size <value>]
[--scoped-session-description <value>]
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]
[--debug]
[--endpoint-url <value>]
[--no-verify-ssl]
[--no-paginate]
[--output <value>]
[--query <value>]
[--profile <value>]
[--region <value>]
[--version <value>]
[--color <value>]
[--no-sign-request]
[--ca-bundle <value>]
[--cli-read-timeout <value>]
[--cli-connect-timeout <value>]
[--cli-binary-format <value>]
[--no-cli-pager]
[--cli-auto-prompt]
[--no-cli-auto-prompt]
[--cli-error-format <value>]
[--help]
--policy (string)
An IAM policy in JSON format that you want to use as a scope down policy.
A request must provide at least one of
PolicyorDurationSeconds. Both parameters are optional individually, but you must specify at least one of them.The resulting session’s permissions are the intersection of the calling session’s existing permissions and this scope down policy. You cannot use this scope down policy to grant more permissions than the calling session already has.
The plaintext of the scope down policy cannot exceed 2,048 characters. The JSON policy characters can be any ASCII character from the space character to the end of the valid character list (u0020 through u00FF). It can also include the tab (u0009), linefeed (u000A), and carriage return (u000D) characters.
Note
An internal conversion compresses the inline scope down policy into a packed binary format that has a separate limit. If the packed policy exceeds this limit, the request fails with
PackedPolicyTooLarge.If the document is not valid IAM policy JSON, the request fails with
MalformedPolicyDocument.Constraints:
- min:
1- max:
2048- pattern:
[\u0009\u000A\u000D\u0020-\u00FF]+
--duration-seconds (integer)
The duration, in seconds, of the resulting scoped down credentials. The value can range from 1 second to 129,600 seconds (36 hours).
If you do not specify this value, the scoped down credentials will inherit the calling session’s expiration time.
Constraints:
- min:
1- max:
129600
--minimum-session-token-size (integer)
The minimum size, in bytes, of the session token that STS issues for the request. STS increases the session token to at least this size, regardless of its actual content. The value must not exceed 4,096 bytes. When set to 0 or not specified, the session token size is unchanged.
Constraints:
- min:
0- max:
4096
--scoped-session-description (string)
A caller-supplied description of the scoped session. The value cannot exceed 256 characters. This description is logged to CloudTrail for the request, so you can use it to record the purpose of the scoped session.
Constraints:
- min:
2- max:
256- pattern:
[\u0009\u000A\u000D\u0020-\u007E\u00A1-\u00FF]*
--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. The generated JSON skeleton is not stable between versions of the AWS CLI and there are no backwards compatibility guarantees in the JSON skeleton generated.
--debug (boolean)
Turn on debug logging.
--endpoint-url (string)
Override command’s default URL with the given URL.
--no-verify-ssl (boolean)
By default, the AWS CLI uses SSL when communicating with AWS services. For each SSL connection, the AWS CLI will verify SSL certificates. This option overrides the default behavior of verifying SSL certificates.
--no-paginate (boolean)
Disable automatic pagination. If automatic pagination is disabled, the AWS CLI will only make one call, for the first page of results.
--output (string)
The formatting style for command output.
--query (string)
A JMESPath query to use in filtering the response data.
--profile (string)
Use a specific profile from your credential file.
--region (string)
The region to use. Overrides config/env settings.
--version (string)
Display the version of this tool.
--color (string)
Turn on/off color output.
--no-sign-request (boolean)
Do not sign requests. Credentials will not be loaded if this argument is provided.
--ca-bundle (string)
The CA certificate bundle to use when verifying SSL certificates. Overrides config/env settings.
--cli-read-timeout (int)
The maximum socket read time in seconds. If the value is set to 0, the socket read will be blocking and not timeout. The default value is 60 seconds.
--cli-connect-timeout (int)
The maximum socket connect time in seconds. If the value is set to 0, the socket connect will be blocking and not timeout. The default value is 60 seconds.
--cli-binary-format (string)
The formatting style to be used for binary blobs. The default format is base64. The base64 format expects binary blobs to be provided as a base64 encoded string. The raw-in-base64-out format preserves compatibility with AWS CLI V1 behavior and binary values must be passed literally. When providing contents from a file that map to a binary blob fileb:// will always be treated as binary and use the file contents directly regardless of the cli-binary-format setting. When using file:// the file contents will need to properly formatted for the configured cli-binary-format.
--no-cli-pager (boolean)
Disable cli pager for output.
--cli-auto-prompt (boolean)
Automatically prompt for CLI input parameters.
--no-cli-auto-prompt (boolean)
Disable automatically prompt for CLI input parameters.
--cli-error-format (string)
The formatting style for error output. By default, errors are displayed in enhanced format.
--help (boolean)
Display help for the command/subcommand.
Credentials -> (structure)
The temporary security credentials for the scoped down session, which include an access key ID, a secret access key, and a security token.
Note
The size of the security token that STS API operations return is not fixed. We strongly recommend that you make no assumptions about the maximum size.AccessKeyId -> (string) [required]
The access key ID that identifies the temporary security credentials.
Constraints:
- min:
16- max:
128- pattern:
[\w]*SecretAccessKey -> (string) [required]
The secret access key that can be used to sign requests.SessionToken -> (string) [required]
The token that users must pass to the service API to use the temporary credentials.Expiration -> (timestamp) [required]
The date on which the current credentials expire.
SessionInfo -> (structure)
Metadata about the resulting scoped session, including its identifier and ARN. Because the identity does not change, the identifiers reflect the same principal and session name as the calling session.
ScopedSessionId -> (string) [required]
A unique identifier for the scoped session. Because the identity is preserved, this identifies the same principal as the calling session.
Constraints:
- min:
2- max:
193- pattern:
[\w+=,.@:-]*Arn -> (string) [required]
The ARN of the scoped session. For more information about ARNs and how to use them in policies, see IAM Identifiers in the IAM User Guide .
Constraints:
- min:
20- max:
2048- pattern:
[\u0009\u000A\u000D\u0020-\u007E\u0085\u00A0-\uD7FF\uE000-\uFFFD\u10000-\u10FFFF]+
SessionTokenUtilization -> (integer)
The percentage (0-100) of the maximum allowed session token size that the returned session token consumes.
Constraints:
- min:
0
SessionTokenSize -> (integer)
The size, in bytes, of the session token returned in the Credentials for this response.
Constraints:
- min:
0
ScopedPoliciesCount -> (integer)
GetScopedCredentialscan be called recursively andScopedPoliciesCountspecifies the number of scope down policies applied to the session. Each recursive call adds another scope down policy layer. A maximum of 3 scope down policy layers are allowed per session. If a session already has 3GetScopedCredentialsscope-down policies, a subsequentGetScopedCredentialscall that supplies aPolicy(attempting to append a fourth scope-down policy) is denied.Constraints:
- min:
0
SourceIdentity -> (string)
The source identity of the calling session, carried forward unchanged. This operation never sets or modifies the source identity; it reflects the value established when the source identity was first set. For more information, see Monitor and control actions taken with assumed roles in the IAM User Guide.
Constraints:
- min:
2- max:
256- pattern:
[\w+=,.@-]*