register_image
¶
register_image(
*,
config_overrides: Optional[EC2ClientConfig] = None,
image_location: Optional[String] = None,
billing_products: Optional[BillingProductList] = None,
boot_mode: Optional[BootModeValues] = None,
tpm_support: Optional[TpmSupportValues] = None,
uefi_data: Optional[ImageUefiDataRequest] = None,
imds_support: Optional[ImdsSupportValues] = None,
tag_specifications: Optional[TagSpecificationList] = None,
dry_run: Optional[Boolean] = None,
name: Optional[ImageNameRequest] = None,
description: Optional[ImageDescriptionRequest] = None,
architecture: Optional[ArchitectureValues] = None,
kernel_id: Optional[KernelId] = None,
ramdisk_id: Optional[RamdiskId] = None,
root_device_name: Optional[String] = None,
block_device_mappings: Optional[BlockDeviceMappingRequestList] = None,
virtualization_type: Optional[String] = None,
sriov_net_support: Optional[String] = None,
ena_support: Optional[Boolean] = None,
) -> RegisterImageResult
Registers an AMI. When you're creating an instance-store backed AMI, registering the AMI is the final step in the creation process. For more information about creating AMIs, see Create an AMI from a snapshot and Create an instance-store backed AMI in the Amazon EC2 User Guide.
If needed, you can deregister an AMI at any time. Any modifications you make to an AMI backed by an instance store volume invalidates its registration. If you make changes to an image, deregister the previous image and register the new image.
Register a snapshot of a root device volume
You can use RegisterImage to create an Amazon EBS-backed Linux AMI from a snapshot of a root device volume. You specify the snapshot using a block device mapping. You can't set the encryption state of the volume using the block device mapping. If the snapshot is encrypted, or encryption by default is enabled, the root volume of an instance launched from the AMI is encrypted.
For more information, see Create an AMI from a snapshot and Use encryption with EBS-backed AMIs in the Amazon EC2 User Guide.
Amazon Web Services Marketplace product codes
If any snapshots have Amazon Web Services Marketplace product codes, they are copied to the new AMI.
In most cases, AMIs for Windows, RedHat, SUSE, and SQL Server require correct licensing information to be present on the AMI. For more information, see Understand AMI billing information in the Amazon EC2 User Guide. When creating an AMI from a snapshot, the RegisterImage operation derives the correct billing information from the snapshot's metadata, but this requires the appropriate metadata to be present. To verify if the correct billing information was applied, check the PlatformDetails field on the new AMI. If the field is empty or doesn't match the expected operating system code (for example, Windows, RedHat, SUSE, or SQL), the AMI creation was unsuccessful, and you should discard the AMI and instead create the AMI from an instance. For more information, see Create an AMI from an instance in the Amazon EC2 User Guide.
If you purchase a Reserved Instance to apply to an On-Demand Instance that was launched from an AMI with a billing product code, make sure that the Reserved Instance has the matching billing product code. If you purchase a Reserved Instance without the matching billing product code, the Reserved Instance is not applied to the On-Demand Instance. For information about how to obtain the platform details and billing information of an AMI, see Understand AMI billing information in the Amazon EC2 User Guide.
Parameters:
-
image_location(Optional[String], default:None) –The full path to your AMI manifest in Amazon S3 storage. The specified bucket must have the
aws-exec-readcanned access control list (ACL) to ensure that it can be accessed by Amazon EC2. For more information, see Canned ACL in the Amazon S3 Service Developer Guide. -
billing_products(Optional[BillingProductList], default:None) –The billing product codes. Your account must be authorized to specify billing product codes.
If your account is not authorized to specify billing product codes, you can publish AMIs that include billable software and list them on the Amazon Web Services Marketplace. You must first register as a seller on the Amazon Web Services Marketplace. For more information, see Getting started as an Amazon Web Services Marketplace seller and AMI-based products in Amazon Web Services Marketplace in the Amazon Web Services Marketplace Seller Guide.
-
boot_mode(Optional[BootModeValues], default:None) –The boot mode of the AMI. A value of
uefi-preferredindicates that the AMI supports both UEFI and Legacy BIOS.The operating system contained in the AMI must be configured to support the specified boot mode.
For more information, see Instance launch behavior with Amazon EC2 boot modes in the Amazon EC2 User Guide.
-
tpm_support(Optional[TpmSupportValues], default:None) –Set to
v2.0to enable Trusted Platform Module (TPM) support. For more information, see NitroTPM in the Amazon EC2 User Guide. -
uefi_data(Optional[ImageUefiDataRequest], default:None) –Base64 representation of the non-volatile UEFI variable store. To retrieve the UEFI data, use the GetInstanceUefiData command. You can inspect and modify the UEFI data by using the python-uefivars tool on GitHub. For more information, see UEFI Secure Boot for Amazon EC2 instances in the Amazon EC2 User Guide.
-
imds_support(Optional[ImdsSupportValues], 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.If you set the value to
v2.0, make sure that your AMI software can support IMDSv2. -
tag_specifications(Optional[TagSpecificationList], default:None) –The tags to apply to the AMI.
To tag the AMI, the value for
ResourceTypemust beimage. If you specify another value forResourceType, the request fails.To tag an AMI after it has been registered, see CreateTags.
-
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. -
name(Optional[ImageNameRequest], default:None) –A name for your AMI.
Constraints: 3-128 alphanumeric characters, parentheses (()), square brackets ([]), spaces ( ), periods (.), slashes (/), dashes (-), single quotes ('), at-signs (@), or underscores(_)
-
description(Optional[ImageDescriptionRequest], default:None) –A description for your AMI.
-
architecture(Optional[ArchitectureValues], default:None) –The architecture of the AMI.
Default: For Amazon EBS-backed AMIs,
i386. For instance store-backed AMIs, the architecture specified in the manifest file. -
kernel_id(Optional[KernelId], default:None) –The ID of the kernel.
-
ramdisk_id(Optional[RamdiskId], default:None) –The ID of the RAM disk.
-
root_device_name(Optional[String], default:None) –The device name of the root device volume (for example,
/dev/sda1). -
block_device_mappings(Optional[BlockDeviceMappingRequestList], default:None) –The block device mapping entries.
If you specify an Amazon EBS volume using the ID of an Amazon EBS snapshot, you can't specify the encryption state of the volume.
If you create an AMI on an Outpost, then all backing snapshots must be on the same Outpost or in the Region of that Outpost. AMIs on an Outpost that include local snapshots can be used to launch instances on the same Outpost only. For more information, Create AMIs from local snapshots in the Amazon EBS User Guide.
-
virtualization_type(Optional[String], default:None) –The type of virtualization (
hvm|paravirtual).Default:
paravirtual -
sriov_net_support(Optional[String], default:None) –Set to
simpleto enable enhanced networking with the Intel 82599 Virtual Function interface for the AMI and any instances that you launch from the AMI.There is no way to disable
sriovNetSupportat this time.This option is supported only for HVM AMIs. Specifying this option with a PV AMI can make instances launched from the AMI unreachable.
-
ena_support(Optional[Boolean], default:None) –Set to
trueto enable enhanced networking with ENA for the AMI and any instances that you launch from the AMI.This option is supported only for HVM AMIs. Specifying this option with a PV AMI can make instances launched from the AMI unreachable.
Raises:
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_ec2/_services/ec2.py
55983 55984 55985 55986 55987 55988 55989 55990 55991 55992 55993 55994 55995 55996 55997 55998 55999 56000 56001 56002 56003 56004 56005 56006 56007 56008 56009 56010 56011 56012 56013 56014 56015 56016 56017 56018 56019 56020 56021 56022 56023 56024 56025 56026 56027 56028 56029 56030 56031 56032 56033 56034 56035 56036 56037 56038 56039 56040 56041 56042 56043 56044 56045 56046 56047 56048 56049 56050 56051 56052 56053 56054 56055 56056 56057 56058 56059 56060 56061 56062 56063 56064 56065 56066 56067 56068 56069 56070 56071 56072 56073 56074 56075 56076 56077 56078 56079 56080 56081 56082 56083 56084 56085 56086 56087 56088 56089 56090 56091 56092 56093 56094 56095 56096 56097 56098 56099 56100 56101 56102 56103 56104 56105 56106 56107 56108 56109 56110 56111 56112 56113 56114 56115 56116 56117 | |