Enabling "Allow" in instance metadata

0

I have been trying to enable "Allow" option in Instance metadata tag using boto3 and referred to the below format from link shared below

response = client.modify_instance_metadata_options( InstanceId='string', HttpTokens='optional'|'required', HttpPutResponseHopLimit=123, HttpEndpoint='disabled'|'enabled', DryRun=True|False, HttpProtocolIpv6='disabled'|'enabled', InstanceMetadataTags='disabled'|'enabled' )

ref link : https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html?highlight=vpcendpoint#EC2.Client.modify_instance_metadata_options https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html

With the above reference , please find the usage in my case as below

****USAGE : ****

client = self.get_service(service_type, region) client.modify_instance_metadata_options(InstanceId=resource_id,InstanceMetadataTags="enabled")

While executing the above scenarios, am facing Unknown parameter in input

E botocore.exceptions.ParamValidationError: Parameter validation failed:

E Unknown parameter in input: "InstanceMetadataTags", must be one of: InstanceId, HttpTokens, HttpPutResponseHopLimit, HttpEndpoint, DryRun

It'll be really helpful if anyone could help me in correct usage or in resolving this TIA

1 Answer
0

Have you checked the version of boto3 and botocore that you're running to make sure that it is the latest? The error message indicates that it doesn't recognise InstanceMetadataTags so my guess here is that the version you're running is earlier than is required to support that parameter.

profile pictureAWS
EXPERT
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions