Image
Creates a custom image. You can then use a custom image to create ECS instances (RunInstances) or change the system disk for an existing instance (ReplaceSystemDisk).
NOTE: If you want to create a template from an ECS instance, you can specify the instance ID (InstanceId) to create a custom image. You must make sure that the status of the specified instance is Running or Stopped. After a successful invocation, each disk of the specified instance has a new snapshot created.
NOTE: If you want to create a custom image based on the system disk of your ECS instance, you can specify one of the system disk snapshots (SnapshotId) to create a custom image. However, the specified snapshot cannot be created on or before July 15, 2013.
NOTE: If you want to combine snapshots of multiple disks into an image template, you can specify DiskDeviceMapping to create a custom image.
NOTE: Available in 1.64.0+
Example Usage
using Pulumi;
using AliCloud = Pulumi.AliCloud;
class MyStack : Stack
{
public MyStack()
{
var @default = new AliCloud.Ecs.Image("default", new AliCloud.Ecs.ImageArgs
{
Architecture = "x86_64",
Description = "test-image",
ImageName = "test-image",
InstanceId = "i-bp1g6zv0ce8oghu7k***",
Platform = "CentOS",
ResourceGroupId = "rg-bp67acfmxazb4ph***",
Tags =
{
{ "FinanceDept", "FinanceDeptJoshua" },
},
});
}
}
Coming soon!
import pulumi
import pulumi_alicloud as alicloud
default = alicloud.ecs.Image("default",
architecture="x86_64",
description="test-image",
image_name="test-image",
instance_id="i-bp1g6zv0ce8oghu7k***",
platform="CentOS",
resource_group_id="rg-bp67acfmxazb4ph***",
tags={
"FinanceDept": "FinanceDeptJoshua",
})import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const defaultImage = new alicloud.ecs.Image("default", {
architecture: "x86_64",
description: "test-image",
imageName: "test-image",
instanceId: "i-bp1g6zv0ce8oghu7k***",
platform: "CentOS",
resourceGroupId: "rg-bp67acfmxazb4ph***",
tags: {
FinanceDept: "FinanceDeptJoshua",
},
});Create a Image Resource
new Image(name: string, args?: ImageArgs, opts?: CustomResourceOptions);def Image(resource_name, opts=None, architecture=None, description=None, disk_device_mappings=None, force=None, image_name=None, instance_id=None, name=None, platform=None, resource_group_id=None, snapshot_id=None, tags=None, __props__=None);public Image(string name, ImageArgs? args = null, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args ImageArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args ImageArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ImageArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
Image Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The Image resource accepts the following input properties:
- Architecture string
Specifies the architecture of the system disk after you specify a data disk snapshot as the data source of the system disk for creating an image. Valid values:
i386, Default isx86_64.- Description string
The description of the image. It must be 2 to 256 characters in length and must not start with http:// or https://. Default value: null.
- Disk
Device List<Pulumi.Mappings Ali Cloud. Ecs. Inputs. Image Disk Device Mapping Args> Description of the system with disks and snapshots under the image.
- Force bool
Indicates whether to force delete the custom image, Default is
false. - true:Force deletes the custom image, regardless of whether the image is currently being used by other instances. - false:Verifies that the image is not currently in use by any other instances before deleting the image.- Image
Name string The image name. It must be 2 to 128 characters in length, and must begin with a letter or Chinese character (beginning with http:// or https:// is not allowed). It can contain digits, colons (:), underscores (_), or hyphens (-). Default value: null.
- Instance
Id string The instance ID.
- Name string
- Platform string
Specifies the operating system platform of the system disk after you specify a data disk snapshot as the data source of the system disk for creating an image. Valid values:
CentOS,Ubuntu,SUSE,OpenSUSE,RedHat,Debian,CoreOS,Aliyun Linux,Windows Server 2003,Windows Server 2008,Windows Server 2012,Windows 7, Default isOthers Linux,Customized Linux.- Resource
Group stringId The ID of the enterprise resource group to which a custom image belongs
- Snapshot
Id string Specifies a snapshot that is used to create a combined custom image.
- Dictionary<string, object>
The tag value of an image. The value of N ranges from 1 to 20.
- Architecture string
Specifies the architecture of the system disk after you specify a data disk snapshot as the data source of the system disk for creating an image. Valid values:
i386, Default isx86_64.- Description string
The description of the image. It must be 2 to 256 characters in length and must not start with http:// or https://. Default value: null.
- Disk
Device []ImageMappings Disk Device Mapping Description of the system with disks and snapshots under the image.
- Force bool
Indicates whether to force delete the custom image, Default is
false. - true:Force deletes the custom image, regardless of whether the image is currently being used by other instances. - false:Verifies that the image is not currently in use by any other instances before deleting the image.- Image
Name string The image name. It must be 2 to 128 characters in length, and must begin with a letter or Chinese character (beginning with http:// or https:// is not allowed). It can contain digits, colons (:), underscores (_), or hyphens (-). Default value: null.
- Instance
Id string The instance ID.
- Name string
- Platform string
Specifies the operating system platform of the system disk after you specify a data disk snapshot as the data source of the system disk for creating an image. Valid values:
CentOS,Ubuntu,SUSE,OpenSUSE,RedHat,Debian,CoreOS,Aliyun Linux,Windows Server 2003,Windows Server 2008,Windows Server 2012,Windows 7, Default isOthers Linux,Customized Linux.- Resource
Group stringId The ID of the enterprise resource group to which a custom image belongs
- Snapshot
Id string Specifies a snapshot that is used to create a combined custom image.
- map[string]interface{}
The tag value of an image. The value of N ranges from 1 to 20.
- architecture string
Specifies the architecture of the system disk after you specify a data disk snapshot as the data source of the system disk for creating an image. Valid values:
i386, Default isx86_64.- description string
The description of the image. It must be 2 to 256 characters in length and must not start with http:// or https://. Default value: null.
- disk
Device ImageMappings Disk Device Mapping[] Description of the system with disks and snapshots under the image.
- force boolean
Indicates whether to force delete the custom image, Default is
false. - true:Force deletes the custom image, regardless of whether the image is currently being used by other instances. - false:Verifies that the image is not currently in use by any other instances before deleting the image.- image
Name string The image name. It must be 2 to 128 characters in length, and must begin with a letter or Chinese character (beginning with http:// or https:// is not allowed). It can contain digits, colons (:), underscores (_), or hyphens (-). Default value: null.
- instance
Id string The instance ID.
- name string
- platform string
Specifies the operating system platform of the system disk after you specify a data disk snapshot as the data source of the system disk for creating an image. Valid values:
CentOS,Ubuntu,SUSE,OpenSUSE,RedHat,Debian,CoreOS,Aliyun Linux,Windows Server 2003,Windows Server 2008,Windows Server 2012,Windows 7, Default isOthers Linux,Customized Linux.- resource
Group stringId The ID of the enterprise resource group to which a custom image belongs
- snapshot
Id string Specifies a snapshot that is used to create a combined custom image.
- {[key: string]: any}
The tag value of an image. The value of N ranges from 1 to 20.
- architecture str
Specifies the architecture of the system disk after you specify a data disk snapshot as the data source of the system disk for creating an image. Valid values:
i386, Default isx86_64.- description str
The description of the image. It must be 2 to 256 characters in length and must not start with http:// or https://. Default value: null.
- disk_
device_ List[Imagemappings Disk Device Mapping] Description of the system with disks and snapshots under the image.
- force bool
Indicates whether to force delete the custom image, Default is
false. - true:Force deletes the custom image, regardless of whether the image is currently being used by other instances. - false:Verifies that the image is not currently in use by any other instances before deleting the image.- image_
name str The image name. It must be 2 to 128 characters in length, and must begin with a letter or Chinese character (beginning with http:// or https:// is not allowed). It can contain digits, colons (:), underscores (_), or hyphens (-). Default value: null.
- instance_
id str The instance ID.
- name str
- platform str
Specifies the operating system platform of the system disk after you specify a data disk snapshot as the data source of the system disk for creating an image. Valid values:
CentOS,Ubuntu,SUSE,OpenSUSE,RedHat,Debian,CoreOS,Aliyun Linux,Windows Server 2003,Windows Server 2008,Windows Server 2012,Windows 7, Default isOthers Linux,Customized Linux.- resource_
group_ strid The ID of the enterprise resource group to which a custom image belongs
- snapshot_
id str Specifies a snapshot that is used to create a combined custom image.
- Dict[str, Any]
The tag value of an image. The value of N ranges from 1 to 20.
Outputs
All input properties are implicitly available as output properties. Additionally, the Image resource produces the following output properties:
Look up an Existing Image Resource
Get an existing Image resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: ImageState, opts?: CustomResourceOptions): Imagestatic get(resource_name, id, opts=None, architecture=None, description=None, disk_device_mappings=None, force=None, image_name=None, instance_id=None, name=None, platform=None, resource_group_id=None, snapshot_id=None, tags=None, __props__=None);func GetImage(ctx *Context, name string, id IDInput, state *ImageState, opts ...ResourceOption) (*Image, error)public static Image Get(string name, Input<string> id, ImageState? state, CustomResourceOptions? opts = null)- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
The following state arguments are supported:
- Architecture string
Specifies the architecture of the system disk after you specify a data disk snapshot as the data source of the system disk for creating an image. Valid values:
i386, Default isx86_64.- Description string
The description of the image. It must be 2 to 256 characters in length and must not start with http:// or https://. Default value: null.
- Disk
Device List<Pulumi.Mappings Ali Cloud. Ecs. Inputs. Image Disk Device Mapping Args> Description of the system with disks and snapshots under the image.
- Force bool
Indicates whether to force delete the custom image, Default is
false. - true:Force deletes the custom image, regardless of whether the image is currently being used by other instances. - false:Verifies that the image is not currently in use by any other instances before deleting the image.- Image
Name string The image name. It must be 2 to 128 characters in length, and must begin with a letter or Chinese character (beginning with http:// or https:// is not allowed). It can contain digits, colons (:), underscores (_), or hyphens (-). Default value: null.
- Instance
Id string The instance ID.
- Name string
- Platform string
Specifies the operating system platform of the system disk after you specify a data disk snapshot as the data source of the system disk for creating an image. Valid values:
CentOS,Ubuntu,SUSE,OpenSUSE,RedHat,Debian,CoreOS,Aliyun Linux,Windows Server 2003,Windows Server 2008,Windows Server 2012,Windows 7, Default isOthers Linux,Customized Linux.- Resource
Group stringId The ID of the enterprise resource group to which a custom image belongs
- Snapshot
Id string Specifies a snapshot that is used to create a combined custom image.
- Dictionary<string, object>
The tag value of an image. The value of N ranges from 1 to 20.
- Architecture string
Specifies the architecture of the system disk after you specify a data disk snapshot as the data source of the system disk for creating an image. Valid values:
i386, Default isx86_64.- Description string
The description of the image. It must be 2 to 256 characters in length and must not start with http:// or https://. Default value: null.
- Disk
Device []ImageMappings Disk Device Mapping Description of the system with disks and snapshots under the image.
- Force bool
Indicates whether to force delete the custom image, Default is
false. - true:Force deletes the custom image, regardless of whether the image is currently being used by other instances. - false:Verifies that the image is not currently in use by any other instances before deleting the image.- Image
Name string The image name. It must be 2 to 128 characters in length, and must begin with a letter or Chinese character (beginning with http:// or https:// is not allowed). It can contain digits, colons (:), underscores (_), or hyphens (-). Default value: null.
- Instance
Id string The instance ID.
- Name string
- Platform string
Specifies the operating system platform of the system disk after you specify a data disk snapshot as the data source of the system disk for creating an image. Valid values:
CentOS,Ubuntu,SUSE,OpenSUSE,RedHat,Debian,CoreOS,Aliyun Linux,Windows Server 2003,Windows Server 2008,Windows Server 2012,Windows 7, Default isOthers Linux,Customized Linux.- Resource
Group stringId The ID of the enterprise resource group to which a custom image belongs
- Snapshot
Id string Specifies a snapshot that is used to create a combined custom image.
- map[string]interface{}
The tag value of an image. The value of N ranges from 1 to 20.
- architecture string
Specifies the architecture of the system disk after you specify a data disk snapshot as the data source of the system disk for creating an image. Valid values:
i386, Default isx86_64.- description string
The description of the image. It must be 2 to 256 characters in length and must not start with http:// or https://. Default value: null.
- disk
Device ImageMappings Disk Device Mapping[] Description of the system with disks and snapshots under the image.
- force boolean
Indicates whether to force delete the custom image, Default is
false. - true:Force deletes the custom image, regardless of whether the image is currently being used by other instances. - false:Verifies that the image is not currently in use by any other instances before deleting the image.- image
Name string The image name. It must be 2 to 128 characters in length, and must begin with a letter or Chinese character (beginning with http:// or https:// is not allowed). It can contain digits, colons (:), underscores (_), or hyphens (-). Default value: null.
- instance
Id string The instance ID.
- name string
- platform string
Specifies the operating system platform of the system disk after you specify a data disk snapshot as the data source of the system disk for creating an image. Valid values:
CentOS,Ubuntu,SUSE,OpenSUSE,RedHat,Debian,CoreOS,Aliyun Linux,Windows Server 2003,Windows Server 2008,Windows Server 2012,Windows 7, Default isOthers Linux,Customized Linux.- resource
Group stringId The ID of the enterprise resource group to which a custom image belongs
- snapshot
Id string Specifies a snapshot that is used to create a combined custom image.
- {[key: string]: any}
The tag value of an image. The value of N ranges from 1 to 20.
- architecture str
Specifies the architecture of the system disk after you specify a data disk snapshot as the data source of the system disk for creating an image. Valid values:
i386, Default isx86_64.- description str
The description of the image. It must be 2 to 256 characters in length and must not start with http:// or https://. Default value: null.
- disk_
device_ List[Imagemappings Disk Device Mapping] Description of the system with disks and snapshots under the image.
- force bool
Indicates whether to force delete the custom image, Default is
false. - true:Force deletes the custom image, regardless of whether the image is currently being used by other instances. - false:Verifies that the image is not currently in use by any other instances before deleting the image.- image_
name str The image name. It must be 2 to 128 characters in length, and must begin with a letter or Chinese character (beginning with http:// or https:// is not allowed). It can contain digits, colons (:), underscores (_), or hyphens (-). Default value: null.
- instance_
id str The instance ID.
- name str
- platform str
Specifies the operating system platform of the system disk after you specify a data disk snapshot as the data source of the system disk for creating an image. Valid values:
CentOS,Ubuntu,SUSE,OpenSUSE,RedHat,Debian,CoreOS,Aliyun Linux,Windows Server 2003,Windows Server 2008,Windows Server 2012,Windows 7, Default isOthers Linux,Customized Linux.- resource_
group_ strid The ID of the enterprise resource group to which a custom image belongs
- snapshot_
id str Specifies a snapshot that is used to create a combined custom image.
- Dict[str, Any]
The tag value of an image. The value of N ranges from 1 to 20.
Supporting Types
ImageDiskDeviceMapping
- Device string
Specifies the name of a disk in the combined custom image. Value range: /dev/xvda to /dev/xvdz.
- Disk
Type string Specifies the type of a disk in the combined custom image. If you specify this parameter, you can use a data disk snapshot as the data source of a system disk for creating an image. If it is not specified, the disk type is determined by the corresponding snapshot. Valid values:
system,data,- Size int
Specifies the size of a disk in the combined custom image, in GiB. Value range: 5 to 2000.
- Snapshot
Id string Specifies a snapshot that is used to create a combined custom image.
- Device string
Specifies the name of a disk in the combined custom image. Value range: /dev/xvda to /dev/xvdz.
- Disk
Type string Specifies the type of a disk in the combined custom image. If you specify this parameter, you can use a data disk snapshot as the data source of a system disk for creating an image. If it is not specified, the disk type is determined by the corresponding snapshot. Valid values:
system,data,- Size int
Specifies the size of a disk in the combined custom image, in GiB. Value range: 5 to 2000.
- Snapshot
Id string Specifies a snapshot that is used to create a combined custom image.
- device string
Specifies the name of a disk in the combined custom image. Value range: /dev/xvda to /dev/xvdz.
- disk
Type string Specifies the type of a disk in the combined custom image. If you specify this parameter, you can use a data disk snapshot as the data source of a system disk for creating an image. If it is not specified, the disk type is determined by the corresponding snapshot. Valid values:
system,data,- size number
Specifies the size of a disk in the combined custom image, in GiB. Value range: 5 to 2000.
- snapshot
Id string Specifies a snapshot that is used to create a combined custom image.
- device str
Specifies the name of a disk in the combined custom image. Value range: /dev/xvda to /dev/xvdz.
- disk_
type str Specifies the type of a disk in the combined custom image. If you specify this parameter, you can use a data disk snapshot as the data source of a system disk for creating an image. If it is not specified, the disk type is determined by the corresponding snapshot. Valid values:
system,data,- size float
Specifies the size of a disk in the combined custom image, in GiB. Value range: 5 to 2000.
- snapshot_
id str Specifies a snapshot that is used to create a combined custom image.
Package Details
- Repository
- https://github.com/pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloudTerraform Provider.