aws-samples / aws-samples/outbound-vpc-filtering-proxy

Add IMDSv2 support

Open
#7 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
33
Forks
36
PR merge metrics
No merged PRs in 30d

Description

The template is older and does not take into account IMDSv2

The following needs to be updated

~line 447
`TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"`
region=`curl -H "X-aws-ec2-metadata-token: $TOKEN" --silent http://169.254.169.254/latest/dynamic/instance-identity/document | grep region | cut -f 4 -d '"'`instanceId=`curl -H "X-aws-ec2-metadata-token: $TOKEN" --silent http://169.254.169.254/latest/meta-data/instance-id``

and line ~628
`TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"`
aws ec2 associate-address --region ${AWS::Region} --instance-id $(curl -H "X-aws-ec2-metadata-token: $TOKEN" -s http://169.254.169.254/latest/meta-data/instance-id) --allocation-id $freeEIP --allow-reassociation || error_exit 'Failed to Associate Elastic IP'`

Contributor guide

Open the contributing guide

Research direction

Open the template and inspect the shell commands around lines 447 and 628. Verify both instance-metadata lookups use the IMDSv2 token flow shown in the issue, then validate that the template still retrieves the region and instance ID and associates the Elastic IP successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, shell
Domain
cloud, infrastructure
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.