Skip to content
This repository has been archived by the owner on Nov 8, 2021. It is now read-only.

Commit

Permalink
Add support for AWS IMDSv2 (#158)
Browse files Browse the repository at this point in the history
Co-authored-by: Alexander Tarasov <[email protected]>
  • Loading branch information
Alexander Tarasov and Alexander Tarasov authored Jul 31, 2020
1 parent 1196ff4 commit 00a62f9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions import_users.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ fi
: ${USERDEL_ARGS:="--force --remove"}

# Initizalize INSTANCE variable
INSTANCE_ID=$(curl -s http://169.254.169.254/latest/meta-data/instance-id)
REGION=$(curl -s http://169.254.169.254/latest/dynamic/instance-identity/document | grep region | awk -F\" '{print $4}')
METADATA_TOKEN=$(curl -s -X PUT -H 'x-aws-ec2-metadata-token-ttl-seconds: 60' http://169.254.169.254/latest/api/token)
INSTANCE_ID=$(curl -s -H "x-aws-ec2-metadata-token: ${METADATA_TOKEN}" http://169.254.169.254/latest/meta-data/instance-id)
REGION=$(curl -s -H "x-aws-ec2-metadata-token: ${METADATA_TOKEN}" http://169.254.169.254/latest/dynamic/instance-identity/document | grep region | awk -F\" '{print $4}')

function setup_aws_credentials() {
local stscredentials
Expand Down

0 comments on commit 00a62f9

Please sign in to comment.