Skip to content

Commit

Permalink
upgrade metadata call to use IMDSv2, only supported version soon (#180)
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: #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
  • Loading branch information
wdvr authored and facebook-github-bot committed Nov 5, 2024
1 parent f98742e commit 0139a68
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/run_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,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 0139a68

Please sign in to comment.