Using Console
Using CLI
modify-instance-metadata-options
API to enable IMDSv2 on the current EC2 instance by passing --http-endpoint enabled
and --http-tokens required
parameters.modify-instance-metadata-options
API to enable IMDSv2 on all new EC2 instances launched in the current region by passing --http-endpoint enabled
and --http-tokens required
parameters.Using Python