Skip to content

EC2  >  Operations  >  modify_instance_metadata_defaults

modify_instance_metadata_defaults

Operation

modify_instance_metadata_defaults async

modify_instance_metadata_defaults(input: ModifyInstanceMetadataDefaultsInput, plugins: list[Plugin] | None = None) -> ModifyInstanceMetadataDefaultsOutput

Modifies the default instance metadata service (IMDS) settings at the account level in the specified Amazon Web Services
 Region.

Note

To remove a parameter's account-level default setting, specify no-preference. If an account-level setting is cleared with no-preference, then the instance launch considers the other instance metadata settings. For more information, see Order of precedence for instance metadata options in the Amazon EC2 User Guide.

Parameters:

Name Type Description Default
input ModifyInstanceMetadataDefaultsInput

An instance of ModifyInstanceMetadataDefaultsInput.

required
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
ModifyInstanceMetadataDefaultsOutput

An instance of ModifyInstanceMetadataDefaultsOutput.

Input

ModifyInstanceMetadataDefaultsInput dataclass

Bases: _SerdeShape

Dataclass for ModifyInstanceMetadataDefaultsInput structure.

Attributes

dry_run class-attribute instance-attribute
dry_run: bool | None = ...

Checks whether you have the required permissions for the operation, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

http_endpoint class-attribute instance-attribute
http_endpoint: str | None = ...

Enables or disables the IMDS endpoint on an instance. When disabled, the instance metadata can't be accessed.

http_put_response_hop_limit class-attribute instance-attribute
http_put_response_hop_limit: int | None = ...

The maximum number of hops that the metadata token can travel. To indicate no preference, specify -1.

Possible values: Integers from 1 to 64, and -1 to indicate no preference

http_tokens class-attribute instance-attribute
http_tokens: str | None = ...

Indicates whether IMDSv2 is required.

  • optional -- IMDSv2 is optional, which means that you can use either IMDSv2 or IMDSv1.

  • required -- IMDSv2 is required, which means that IMDSv1 is disabled, and you must use IMDSv2.

http_tokens_enforced class-attribute instance-attribute
http_tokens_enforced: str | None = ...

Specifies whether to enforce the requirement of IMDSv2 on an instance at the time of launch. When enforcement is enabled, the instance can't launch unless IMDSv2 (HttpTokens) is set to required. For more information, see Enforce IMDSv2 at the account level in the Amazon EC2 User Guide.

instance_metadata_tags class-attribute instance-attribute
instance_metadata_tags: str | None = ...

Enables or disables access to an instance's tags from the instance metadata. For more information, see View tags for your EC2 instances using instance metadata in the Amazon EC2 User Guide.

Output

ModifyInstanceMetadataDefaultsOutput dataclass

Bases: _SerdeShape

Dataclass for ModifyInstanceMetadataDefaultsOutput structure.

Attributes

response_metadata class-attribute instance-attribute
response_metadata: ResponseMetadata = ...

Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.

return_ class-attribute instance-attribute
return_: bool | None = ...

If the request succeeds, the response returns true. If the request fails, no response is returned, and instead an error message is returned.