Skip to content

Commit 61a91b3

Browse files
committed
update increase disk size script to work with imdsv2
1 parent f397803 commit 61a91b3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Cloud9Setup/increase-disk-size.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
# Specify the desired volume size in GiB as a command line argument. If not specified, default to 50 GiB.
44
SIZE=50
55

6+
# generate token to access instance metadata
7+
TOKEN=$(curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 5")
8+
69
# Get the ID of the environment host Amazon EC2 instance.
7-
INSTANCEID=$(curl http://169.254.169.254/latest/meta-data/instance-id)
8-
REGION=$(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone | sed 's/\(.*\)[a-z]/\1/')
10+
INSTANCEID=$(curl -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/instance-id)
11+
REGION=$(curl -H "X-aws-ec2-metadata-token: $TOKEN" -s http://169.254.169.254/latest/meta-data/placement/availability-zone | sed 's/\(.*\)[a-z]/\1/')
912

1013
# Get the ID of the Amazon EBS volume associated with the instance.
1114
VOLUMEID=$(aws ec2 describe-instances \

0 commit comments

Comments
 (0)