This topic explains how an ECS image deployment package works and guides you through creating and using one.
Background
-
Why use an ECS image deployment package?
When deploying services, you often use ECS images to support deployments in multiple regions. However, because ECS images are region-specific, you must replicate these images in each target region and specify the corresponding image ID in the template for each region. This process, which includes image replication, mapping, and permission management, must be repeated for every new image version, which makes the process complex and tedious.
-
Benefits of an ECS image deployment package
As a service provider, you only need to configure the association for the ECS image deployment package in the Compute Nest console.
-
Image replication: Compute Nest replicates your source image to a shared Compute Nest account and then replicates it across multiple regions under that account.
-
Image mapping: Compute Nest checks whether an
ImageIdis set in the template. If it is, you can associate theImageIdwith an ECS image deployment package on the service details page. When a user deploys the service, Compute Nest identifies the deployment region and automatically replaces theImageIdin the template with the correct image ID for that region, which enables dynamic image mapping. -
Permission management: The permissions of a deployment package are determined by the associated service. If a deployment package is not associated with any service, it is private and available only to the service provider. If it is associated with at least one public service, the deployment package becomes public. If it is associated only with private services, it remains private. In this case, if you add a whitelist to the service, the whitelist also applies to the deployment package.
-
Limitations
An ECS image deployment package can replace the image ID for the following cloud resources in templates.
ROS
If you use ROS for deployment, you must include the image ID, ImageId, in the Resource section of the ROS template.
-
Supported cloud resource types:
-
ECS instance (ALIYUN::ECS::Instance)
-
ECS instance group (ALIYUN::ECS::InstanceGroup)
-
ESS scaling group (ALIYUN::ESS::ScalingGroup)
-
E-HPC cluster (ALIYUN::EHPC::Cluster)
-
-
Resource property:
ImageId. -
The value of the resource attribute must be a string (the image ID). Template input parameters or other built-in template functions are not allowed.
Terraform
If you use Terraform for deployment, you must include the image ID, image_id, in the template.
-
Supported cloud resource types:
-
ECS instance (alicloud_instance)
-
ESS scaling group (ALIYUN::ESS::ScalingGroup)
-
-
Resource property:
image_id. -
The value of the resource attribute must be a string (the image ID). Template input parameters or other built-in template functions are not allowed.
Create and use a deployment package
Prerequisites
Prepare an ECS image. Compute Nest supports custom images and Alibaba Cloud Marketplace images. Choose the type that fits your needs.
-
Custom image: You can select an existing ECS image from your account.
If you do not have a custom image, create a custom image first. For more information, see Create a custom image from an instance.
-
Alibaba Cloud Marketplace image: You can select an image product and version that is published on Alibaba Cloud Marketplace.
You can find a suitable image product on Alibaba Cloud Marketplace.
Create an ECS image deployment package
-
Configure basic information for the deployment package.
-
Log on to the Compute Nest console. In the left-side navigation pane, choose Service Deployment Package. On the Packages tab, click Create Deployment Package.
-
In the Basic Information section, configure the following parameters.
Parameter
Description
Deployment Package Name
The name can contain Chinese characters, English letters, digits, and underscores (_). The name must be 3 to 128 characters long, where a Chinese character counts as two characters. The deployment package name cannot be changed after creation.
Version Name
The name can contain Chinese characters, English letters, digits, and underscores (_). The name must be 3 to 50 characters long, where a Chinese character counts as two characters.
Description
The description must be 10 to 500 characters long. A Chinese character counts as two characters.
Resource Group
Select the resource group to which the deployment package belongs.
Resource groups allow you to group your cloud resources by usage, permissions, or ownership, enabling hierarchical resource management for multiple users and projects within an organization. For more information, see resource groups.
Tag Settings
Select or enter a complete tag key and tag value to add a tag to the deployment package. You can bind up to 20 tags to a resource. If no tag keys or values are available, you can create a custom tag. For more information, see Create and bind a custom tag.
-
-
Configure the ECS image deployment package.
-
In the Deployment Package Content section, set Deployment Package Type to ECS Image. For Image Type and Select Product, select the image that you prepared in the prerequisites.
-
In the Distribution Settings section, Distribution Region. This example uses All Regions.
ImportantYou must select at least one distribution region for an ECS image deployment package.
-
Click Publish Deployment Package.
Once published, a deployment package version cannot be modified. To make changes, you must create a new version or a new deployment package.
Note-
To test the deployment package, click Save Deployment Package. After testing is complete, click Publish Deployment Package.
-
If the deployment package is not published, you cannot test it in the configured distribution regions. You can only test it in the region where the image resides.
-
-
-
View the deployment package.
-
Return to the Service deployment package page. Click the name of the newly created deployment package to go to the Deployment Package Details page and view the deployment progress.
-
When the status changes to Available, click View to get the Distribution Results of the ECS image deployment package.
NoteImage distribution time can range from a few minutes to several hours, depending on the region and image size.
-
Use an ECS image deployment package
This section uses a private service as an example and focuses on configuring the ECS image deployment package when you create a service.
-
Log on to the Compute Nest console.
-
In the left-side navigation pane, click My Services. On the Created Services tab of the My Services page, click Create Service.
-
On the Create New Service page, select Custom launch as the creation method, select Private Service as the service type, and click Next: Configure Settings.
-
On the Configure Service page, fill in the basic service information, and then provide a template. This section uses an ROS template as an example.
-
If the Template Content includes the image ID
ImageId, the Deployment package association section appears, where you can Set image association.The system automatically parses the image information from the template, displaying the Image to be replaced as
centos_7and the Associated resource asEcsInstanceGroup`. Click Select deployment package to complete the association. -
Click Select Deployment Package, select a deployment package and version, and then click OK to associate the ECS image deployment package.
Important-
If you select a draft version, the ECS image in that version is not distributed. The image is available only in the region where it was created.
-
If you select a published version, the ECS image is available in the source region and all distributed regions.
In this example, the image to be replaced is
centos_7. In the dialog box, select the deployment package SpringBootEcsImage and choose Version 1. -
-
After you create and test the service, ensure it meets the review criteria of Compute Nest and then submit it for review. For more information, see Review criteria.
-
After the service is approved, publish it. For more information, see Publish a service.
After a service instance is created, the image ID is automatically replaced with the corresponding distribution result from the deployment package.
-
Before replacement:
SecurityGroupId: Ref: EcsSecurityGroup ImageId: centos_7 IoOptimized: optimized InstanceChargeType: Ref: InstanceChargeType -
After replacement:
InternetMaxBandwidthOut: Ref: InternetMaxBandwidthOut ImageId: m-bp1dxxx PeriodUnit: Ref: PayPeriodUnit
-
Related documents
-
For more information about how to create a service in Compute Nest, see Create a service.
-
If you no longer need a deployment package or a specific version, you can delete it. For more information, see Delete a deployment package.
-
To change a deployment package's content, distribution regions, or other details, create a new version. For more information, see Create a new version.
-
To configure upgrade settings for a deployment package, see Configure service upgrades.