modify_image_attribute
¶
modify_image_attribute(
*,
config_overrides: Optional[EC2ClientConfig] = None,
attribute: Optional[String] = None,
description: Optional[AttributeValue] = None,
image_id: Optional[ImageId] = None,
launch_permission: Optional[LaunchPermissionModifications] = None,
operation_type: Optional[OperationType] = None,
product_codes: Optional[ProductCodeStringList] = None,
user_groups: Optional[UserGroupStringList] = None,
user_ids: Optional[UserIdStringList] = None,
value: Optional[String] = None,
organization_arns: Optional[OrganizationArnStringList] = None,
organizational_unit_arns: Optional[OrganizationalUnitArnStringList] = None,
imds_support: Optional[AttributeValue] = None,
dry_run: Optional[Boolean] = None,
) -> None
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:
-
attribute(Optional[String], default:None) –The name of the attribute to modify.
Valid values:
description|imdsSupport|launchPermission -
description(Optional[AttributeValue], default:None) –A new description for the AMI.
-
image_id(Optional[ImageId], default:None) –The ID of the AMI.
-
launch_permission(Optional[LaunchPermissionModifications], default:None) –A new launch permission for the AMI.
-
operation_type(Optional[OperationType], default:None) –The operation type. This parameter can be used only when the
Attributeparameter islaunchPermission. -
product_codes(Optional[ProductCodeStringList], default:None) –Not supported.
-
user_groups(Optional[UserGroupStringList], default:None) –The user groups. This parameter can be used only when the
Attributeparameter islaunchPermission. -
user_ids(Optional[UserIdStringList], default:None) –The Amazon Web Services account IDs. This parameter can be used only when the
Attributeparameter islaunchPermission. -
value(Optional[String], default:None) –The value of the attribute being modified. This parameter can be used only when the
Attributeparameter isdescriptionorimdsSupport. -
organization_arns(Optional[OrganizationArnStringList], default:None) –The Amazon Resource Name (ARN) of an organization. This parameter can be used only when the
Attributeparameter islaunchPermission. -
organizational_unit_arns(Optional[OrganizationalUnitArnStringList], default:None) –The Amazon Resource Name (ARN) of an organizational unit (OU). This parameter can be used only when the
Attributeparameter islaunchPermission. -
imds_support(Optional[AttributeValue], default:None) –Set to
v2.0to indicate that IMDSv2 is specified in the AMI. Instances launched from this AMI will haveHttpTokensautomatically set torequiredso that, by default, the instance requires that IMDSv2 is used when requesting instance metadata. In addition,HttpPutResponseHopLimitis set to2. For more information, see Configure the AMI in the Amazon EC2 User Guide.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. -
dry_run(Optional[Boolean], default: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 isUnauthorizedOperation.
Raises:
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To grant launch permissions This example grants launch permissions for the specified AMI to the specified AWS account.
>>> client.modify_image_attribute(image_id='ami-5731123e', launch_permission={'Add': [{'UserId': '123456789012'}]})
To make an AMI public
This example makes the specified AMI public.
>>> client.modify_image_attribute(image_id='ami-5731123e', launch_permission={'Add': [{'Group': 'all'}]})
Source code in docs_src/capo_ec2/_services/ec2.py
49965 49966 49967 49968 49969 49970 49971 49972 49973 49974 49975 49976 49977 49978 49979 49980 49981 49982 49983 49984 49985 49986 49987 49988 49989 49990 49991 49992 49993 49994 49995 49996 49997 49998 49999 50000 50001 50002 50003 50004 50005 50006 50007 50008 50009 50010 50011 50012 50013 50014 50015 50016 50017 50018 50019 50020 50021 50022 50023 50024 50025 50026 50027 50028 50029 50030 50031 50032 50033 50034 50035 50036 50037 50038 50039 50040 50041 50042 50043 50044 50045 50046 50047 50048 50049 50050 50051 50052 50053 50054 50055 50056 50057 50058 50059 50060 50061 50062 50063 50064 50065 50066 50067 50068 50069 50070 50071 50072 50073 50074 50075 | |