일부 IAM 자격 증명을 획득했다면 다음 도구를 사용하여 웹 콘솔에 액세스하는 것에 관심이 있을 수 있습니다.
사용자/역할은 sts:GetFederationToken 권한을 가져야 합니다.
사용자 지정 스크립트
다음 스크립트는 기본 프로필과 기본 AWS 위치(정부 및 중국 제외)를 사용하여 웹 콘솔에 로그인할 수 있는 서명된 URL을 제공합니다:
# Get federated creds (you must indicate a policy or they won't have any perms)## Even if you don't have Admin access you can indicate that policy to make sure you get all your privileges## Don't forget to use [--profile <prof_name>] in the first line if you need tooutput=$(awsstsget-federation-token--nameconsoler--policy-arnsarn=arn:aws:iam::aws:policy/AdministratorAccess)if [ $? -ne0 ]; thenecho"The command 'aws sts get-federation-token --name consoler' failed with exit status $status"exit $statusfi# Parse the outputsession_id=$(echo $output |jq-r '.Credentials.AccessKeyId')session_key=$(echo $output |jq-r '.Credentials.SecretAccessKey')session_token=$(echo $output |jq-r '.Credentials.SessionToken')# Construct the JSON credentials stringjson_creds=$(echo -n "{\"sessionId\":\"$session_id\",\"sessionKey\":\"$session_key\",\"sessionToken\":\"$session_token\"}")
# Define the AWS federation endpointfederation_endpoint="https://signin.aws.amazon.com/federation"# Make the HTTP request to get the sign-in tokenresp=$(curl-s "$federation_endpoint" \--get \--data-urlencode "Action=getSigninToken" \--data-urlencode "SessionDuration=43200" \--data-urlencode "Session=$json_creds")signin_token=$(echo-n $resp |jq-r '.SigninToken' |tr-d '\n' |jq-sRr@uri)# Give the URL to loginecho -n "https://signin.aws.amazon.com/federation?Action=login&Issuer=example.com&Destination=https%3A%2F%2Fconsole.aws.amazon.com%2F&SigninToken=$signin_token"