Movatterモバイル変換


[0]ホーム

URL:


Authenticating with short-term credentials for the AWS CLI - AWS Command Line Interface
DocumentationAWS Command Line InterfaceUser Guide for Version 2

Authenticating with short-term credentials for the AWS CLI

We recommend configuring your SDK or tool to useIAM Identity Center authentication with extended session duration options. However, you can copy and use temporary credentials that are available in the AWS access portal. New credentials will need to be copied when these expire. You can use the temporary credentials in a profile or use them as values for system properties and environment variables.

  1. Sign in to the AWS access portal.

  2. Followthese instructions to copy IAM role credentials from the AWS access portal.

    1. For step 2 in the linked instructions, choose the AWS account and IAM role name that grants access for your development needs. This role typically has a name likePowerUserAccess orDeveloper.

    2. For step 4, select theAdd a profile to your AWS credentials file option and copy the contents.

  3. Create or open the sharedcredentials file. This file is~/.aws/credentials on Linux and macOS systems, and%USERPROFILE%\.aws\credentials on Windows. For more information, seeConfiguration and credential file settings in the AWS CLI.

  4. Add the following text to the sharedcredentials file. Replace the sample values with the credentials you copied.

    [default] aws_access_key_id = AKIAIOSFODNN7EXAMPLE aws_secret_access_key = wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEYaws_session_token = IQoJb3JpZ2luX2IQoJb3JpZ2luX2IQoJb3JpZ2luX2IQoJb3JpZ2luX2IQoJb3JpZVERYLONGSTRINGEXAMPLE
  5. Add your preferred default region and format to the sharedconfig file.

    [default]region=us-west-2output=json[profile user1]region=us-east-1output=text

When the SDK creates a service client, it will access these temporary credentials and use them for each request. The settings for the IAM role chosen in step 2a determinehow long the temporary credentials are valid. The maximum duration is twelve hours.

Repeat these steps each time your credentials expire.

Tutorial: AWS IAM Identity Center and Amazon S3
IAM roles

[8]
ページ先頭

©2009-2025 Movatter.jp