Skip to content

Commit

Permalink
testsys-launcher: add imdsv2-only hack
Browse files Browse the repository at this point in the history
Since there isn't an easy way to force IMDSv2 on instances launched by
the ASG, you can just run this script to restrict IMDS on the nodes.
  • Loading branch information
jpculp committed Aug 30, 2023
1 parent f13b7cf commit 1c9eb53
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions deploy/testsys-launcher/hack/imdsv2-only.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

# The following is a convenience script that can be used to require IMDSv2

instances=$(aws ec2 describe-instances \
--filters "Name=tag-value,Values=testsys" "Name=instance-state-code,Values=16" \
--query "Reservations[*].Instances[*].[InstanceId]" \
--output text)

for instance in ${instances}; do
aws ec2 modify-instance-metadata-options \
--instance-id "${instance}" \
--http-tokens required \
--http-endpoint enabled
done

0 comments on commit 1c9eb53

Please sign in to comment.