Skip to content

Commit 0139a68

Browse files
wdvrfacebook-github-bot
authored andcommitted
upgrade metadata call to use IMDSv2, only supported version soon (#180)
Summary: Soon we will only support metadata fetching for EC2 instances via IMDSv2 - this upgrades the existing v1 call to a v2 call - no functional changes Pull Request resolved: #180 Test Plan: testing if the run_tests.yaml correctly fetches the instance metadata Reviewed By: yifuwang Differential Revision: D65450634 Pulled By: wdvr fbshipit-source-id: 08cc0b6e7ff7f8fec2986c77bfd83c84fea53b92
1 parent f98742e commit 0139a68

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

.github/workflows/run_tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
# Pulled from instance metadata endpoint for EC2
6464
# see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
6565
category=$1
66-
curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
66+
curl -H "X-aws-ec2-metadata-token: $(curl -s -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 30")" -fsSL "http://169.254.169.254/latest/meta-data/${category}"
6767
}
6868
echo "ami-id: $(get_ec2_metadata ami-id)"
6969
echo "instance-id: $(get_ec2_metadata instance-id)"

0 commit comments

Comments
 (0)