File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 3
3
# Specify the desired volume size in GiB as a command line argument. If not specified, default to 50 GiB.
4
4
SIZE=50
5
5
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
+
6
9
# 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/' )
9
12
10
13
# Get the ID of the Amazon EBS volume associated with the instance.
11
14
VOLUMEID=$( aws ec2 describe-instances \
You can’t perform that action at this time.
0 commit comments