Skip to content

Commit

Permalink
upgrade metadata call to use IMDSv2, only supported version soon (#2532)
Browse files Browse the repository at this point in the history
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: #2532

Test Plan:
testing if the release_build.yaml workflow correctly fetches the instance metadata

NOTE: this workflow only runs on pypi release

Reviewed By: wdvr

Differential Revision: D65448148

Pulled By: PaulZhang12

fbshipit-source-id: ebc54fae3c0d27daac043ddc27d5e1ac17549dfc
  • Loading branch information
wdvr authored and facebook-github-bot committed Nov 5, 2024
1 parent 48497bd commit 786bb1e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/release_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ jobs:
# Pulled from instance metadata endpoint for EC2
# see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
category=$1
curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
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}"
}
echo "ami-id: $(get_ec2_metadata ami-id)"
echo "instance-id: $(get_ec2_metadata instance-id)"
Expand Down

0 comments on commit 786bb1e

Please sign in to comment.