Skip to content

EC2  >  Operations  >  modify_image_attribute

modify_image_attribute

Operation

modify_image_attribute async

modify_image_attribute(input: ModifyImageAttributeInput, plugins: list[Plugin] | None = None) -> ModifyImageAttributeOutput

Modifies the specified attribute of the specified AMI. You can specify only one attribute at a time.

To specify the attribute, you can use the Attribute parameter, or one of the following parameters: Description, ImdsSupport, or LaunchPermission.

Images with an Amazon Web Services Marketplace product code cannot be made public.

To enable the SriovNetSupport enhanced networking attribute of an image, enable SriovNetSupport on an instance and create an AMI from the instance.

Parameters:

Name Type Description Default
input ModifyImageAttributeInput

An instance of ModifyImageAttributeInput.

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
ModifyImageAttributeOutput

An instance of ModifyImageAttributeOutput.

Input

ModifyImageAttributeInput dataclass

Bases: _SerdeShape

Contains the parameters for ModifyImageAttribute.

Attributes

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

The name of the attribute to modify.

Valid values: description | imdsSupport | launchPermission

description class-attribute instance-attribute
description: AttributeValue | None = ...

A new description for the AMI.

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

Checks whether you have the required permissions for the action, 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.

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

The ID of the AMI.

imds_support class-attribute instance-attribute
imds_support: AttributeValue | None = ...

Set to v2.0 to indicate that IMDSv2 is specified in the AMI. Instances launched from this AMI will have HttpTokens automatically set to required so that, by default, the instance requires that IMDSv2 is used when requesting instance metadata. In addition, HttpPutResponseHopLimit is set to 2. For more information, see Configure the AMI in the Amazon EC2 User Guide.

Warning

Do not use this parameter unless your AMI software supports IMDSv2. After you set the value to v2.0, you can't undo it. The only way to "reset" your AMI is to create a new AMI from the underlying snapshot.

launch_permission class-attribute instance-attribute
launch_permission: LaunchPermissionModifications | None = ...

A new launch permission for the AMI.

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

The operation type. This parameter can be used only when the Attribute parameter is launchPermission.

organization_arns class-attribute instance-attribute
organization_arns: list[str] | None = ...

The Amazon Resource Name (ARN) of an organization. This parameter can be used only when the Attribute parameter is launchPermission.

organizational_unit_arns class-attribute instance-attribute
organizational_unit_arns: list[str] | None = ...

The Amazon Resource Name (ARN) of an organizational unit (OU). This parameter can be used only when the Attribute parameter is launchPermission.

product_codes class-attribute instance-attribute
product_codes: list[str] | None = ...

Not supported.

user_groups class-attribute instance-attribute
user_groups: list[str] | None = ...

The user groups. This parameter can be used only when the Attribute parameter is launchPermission.

user_ids class-attribute instance-attribute
user_ids: list[str] | None = ...

The Amazon Web Services account IDs. This parameter can be used only when the Attribute parameter is launchPermission.

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

The value of the attribute being modified. This parameter can be used only when the Attribute parameter is description or imdsSupport.

Output

ModifyImageAttributeOutput dataclass

Bases: _SerdeShape

Dataclass for ModifyImageAttributeOutput 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.