modify_image_attribute
async
¶
modify_image_attribute(
*,
config_overrides: Optional[AsyncEC2ClientConfig] = 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.
>>> await 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.
>>> await client.modify_image_attribute(image_id='ami-5731123e', launch_permission={'Add': [{'Group': 'all'}]})
Source code in docs_src/capo_ec2/_services/async_ec2.py
50659 50660 50661 50662 50663 50664 50665 50666 50667 50668 50669 50670 50671 50672 50673 50674 50675 50676 50677 50678 50679 50680 50681 50682 50683 50684 50685 50686 50687 50688 50689 50690 50691 50692 50693 50694 50695 50696 50697 50698 50699 50700 50701 50702 50703 50704 50705 50706 50707 50708 50709 50710 50711 50712 50713 50714 50715 50716 50717 50718 50719 50720 50721 50722 50723 50724 50725 50726 50727 50728 50729 50730 50731 50732 50733 50734 50735 50736 50737 50738 50739 50740 50741 50742 50743 50744 50745 50746 50747 50748 50749 50750 50751 50752 50753 50754 50755 50756 50757 50758 50759 50760 50761 50762 50763 50764 50765 50766 50767 50768 50769 50770 | |