Slide 16
Slide 16 text
作戦2 - CloudShell exports credentials
CloudShell で設定されている AWS_ の環境変数
$ env | grep AWS_ |sort
AWS_CONTAINER_AUTHORIZATION_TOKEN=*******
AWS_CONTAINER_CREDENTIALS_FULL_URI=http://localhost:1338/latest/meta-data/container/security-credentials
AWS_DEFAULT_REGION=ap-northeast-1
AWS_EXECUTION_ENV=CloudShell
AWS_REGION=ap-northeast-1
これでアクセスキーが取得できる
$ curl -H"Authorization: $AWS_CONTAINER_AUTHORIZATION_TOKEN" \
$AWS_CONTAINER_CREDENTIALS_FULL_URI
{
"LastUpdated": "1970-01-01T00:00:00Z",
"Type": "",
"AccessKeyId": "ASIAUSOAHXO5WFCZF5GW",
"SecretAccessKey": "xxxxxxxxxx",
"Token": "xxxxxxxxxxxx"
"Expiration": "2021-05-13T06:09:04Z",
"Code": "Success"
}