From 19c778d1975a19a288dedecb933261a32c3b7476 Mon Sep 17 00:00:00 2001 From: Tianhao Geng Date: Mon, 30 Jan 2023 01:00:18 +0000 Subject: [PATCH] integration-test: enforce IMDSv2 calls when launching instances --- integ/src/nodegroup_provider.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/integ/src/nodegroup_provider.rs b/integ/src/nodegroup_provider.rs index 040f1172..6d4f4743 100644 --- a/integ/src/nodegroup_provider.rs +++ b/integ/src/nodegroup_provider.rs @@ -15,7 +15,8 @@ use aws_sdk_eks::model::IpFamily; use aws_config::meta::region::RegionProviderChain; use aws_sdk_ec2::error::DescribeLaunchTemplatesError; use aws_sdk_ec2::model::{ - ArchitectureValues, InstanceType, LaunchTemplateTagSpecificationRequest, + ArchitectureValues, InstanceType, LaunchTemplateHttpTokensState, + LaunchTemplateInstanceMetadataOptionsRequest, LaunchTemplateTagSpecificationRequest, RequestLaunchTemplateData, ResourceType, Tag, }; @@ -205,6 +206,11 @@ async fn create_launch_template( cluster.dns_ip_info.clone(), )?) .tag_specifications(tag_specifications(&cluster.name)) + .metadata_options( + LaunchTemplateInstanceMetadataOptionsRequest::builder() + .http_tokens(LaunchTemplateHttpTokensState::Required) + .build(), + ) .build(), ) .send()