1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. ens
  5. Image
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

alicloud.ens.Image

Explore with Pulumi AI

Provides a ENS Image resource.

For information about ENS Image and how to use it, see What is Image.

NOTE: Available since v1.216.0.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const config = new pulumi.Config();
const name = config.get("name") || "terraform-example";
const _default = new alicloud.ens.Instance("default", {
    systemDisk: {
        size: 20,
    },
    scheduleAreaLevel: "Region",
    imageId: "centos_6_08_64_20G_alibase_20171208",
    paymentType: "PayAsYouGo",
    password: "12345678ABCabc",
    amount: 1,
    internetMaxBandwidthOut: 10,
    publicIpIdentification: true,
    ensRegionId: "cn-chenzhou-telecom_unicom_cmcc",
    periodUnit: "Month",
    instanceType: "ens.sn1.stiny",
    status: "Stopped",
});
const defaultImage = new alicloud.ens.Image("default", {
    imageName: name,
    instanceId: _default.id,
    deleteAfterImageUpload: "false",
});
Copy
import pulumi
import pulumi_alicloud as alicloud

config = pulumi.Config()
name = config.get("name")
if name is None:
    name = "terraform-example"
default = alicloud.ens.Instance("default",
    system_disk={
        "size": 20,
    },
    schedule_area_level="Region",
    image_id="centos_6_08_64_20G_alibase_20171208",
    payment_type="PayAsYouGo",
    password="12345678ABCabc",
    amount=1,
    internet_max_bandwidth_out=10,
    public_ip_identification=True,
    ens_region_id="cn-chenzhou-telecom_unicom_cmcc",
    period_unit="Month",
    instance_type="ens.sn1.stiny",
    status="Stopped")
default_image = alicloud.ens.Image("default",
    image_name=name,
    instance_id=default.id,
    delete_after_image_upload="false")
Copy
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ens"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		cfg := config.New(ctx, "")
		name := "terraform-example"
		if param := cfg.Get("name"); param != "" {
			name = param
		}
		_default, err := ens.NewInstance(ctx, "default", &ens.InstanceArgs{
			SystemDisk: &ens.InstanceSystemDiskArgs{
				Size: pulumi.Int(20),
			},
			ScheduleAreaLevel:       pulumi.String("Region"),
			ImageId:                 pulumi.String("centos_6_08_64_20G_alibase_20171208"),
			PaymentType:             pulumi.String("PayAsYouGo"),
			Password:                pulumi.String("12345678ABCabc"),
			Amount:                  pulumi.Int(1),
			InternetMaxBandwidthOut: pulumi.Int(10),
			PublicIpIdentification:  pulumi.Bool(true),
			EnsRegionId:             pulumi.String("cn-chenzhou-telecom_unicom_cmcc"),
			PeriodUnit:              pulumi.String("Month"),
			InstanceType:            pulumi.String("ens.sn1.stiny"),
			Status:                  pulumi.String("Stopped"),
		})
		if err != nil {
			return err
		}
		_, err = ens.NewImage(ctx, "default", &ens.ImageArgs{
			ImageName:              pulumi.String(name),
			InstanceId:             _default.ID(),
			DeleteAfterImageUpload: pulumi.String("false"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var config = new Config();
    var name = config.Get("name") ?? "terraform-example";
    var @default = new AliCloud.Ens.Instance("default", new()
    {
        SystemDisk = new AliCloud.Ens.Inputs.InstanceSystemDiskArgs
        {
            Size = 20,
        },
        ScheduleAreaLevel = "Region",
        ImageId = "centos_6_08_64_20G_alibase_20171208",
        PaymentType = "PayAsYouGo",
        Password = "12345678ABCabc",
        Amount = 1,
        InternetMaxBandwidthOut = 10,
        PublicIpIdentification = true,
        EnsRegionId = "cn-chenzhou-telecom_unicom_cmcc",
        PeriodUnit = "Month",
        InstanceType = "ens.sn1.stiny",
        Status = "Stopped",
    });

    var defaultImage = new AliCloud.Ens.Image("default", new()
    {
        ImageName = name,
        InstanceId = @default.Id,
        DeleteAfterImageUpload = "false",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.ens.Instance;
import com.pulumi.alicloud.ens.InstanceArgs;
import com.pulumi.alicloud.ens.inputs.InstanceSystemDiskArgs;
import com.pulumi.alicloud.ens.Image;
import com.pulumi.alicloud.ens.ImageArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var config = ctx.config();
        final var name = config.get("name").orElse("terraform-example");
        var default_ = new Instance("default", InstanceArgs.builder()
            .systemDisk(InstanceSystemDiskArgs.builder()
                .size("20")
                .build())
            .scheduleAreaLevel("Region")
            .imageId("centos_6_08_64_20G_alibase_20171208")
            .paymentType("PayAsYouGo")
            .password("12345678ABCabc")
            .amount("1")
            .internetMaxBandwidthOut("10")
            .publicIpIdentification(true)
            .ensRegionId("cn-chenzhou-telecom_unicom_cmcc")
            .periodUnit("Month")
            .instanceType("ens.sn1.stiny")
            .status("Stopped")
            .build());

        var defaultImage = new Image("defaultImage", ImageArgs.builder()
            .imageName(name)
            .instanceId(default_.id())
            .deleteAfterImageUpload("false")
            .build());

    }
}
Copy
configuration:
  name:
    type: string
    default: terraform-example
resources:
  default:
    type: alicloud:ens:Instance
    properties:
      systemDisk:
        size: '20'
      scheduleAreaLevel: Region
      imageId: centos_6_08_64_20G_alibase_20171208
      paymentType: PayAsYouGo
      password: 12345678ABCabc
      amount: '1'
      internetMaxBandwidthOut: '10'
      publicIpIdentification: true
      ensRegionId: cn-chenzhou-telecom_unicom_cmcc
      periodUnit: Month
      instanceType: ens.sn1.stiny
      status: Stopped
  defaultImage:
    type: alicloud:ens:Image
    name: default
    properties:
      imageName: ${name}
      instanceId: ${default.id}
      deleteAfterImageUpload: 'false'
Copy

Create Image Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new Image(name: string, args: ImageArgs, opts?: CustomResourceOptions);
@overload
def Image(resource_name: str,
          args: ImageArgs,
          opts: Optional[ResourceOptions] = None)

@overload
def Image(resource_name: str,
          opts: Optional[ResourceOptions] = None,
          image_name: Optional[str] = None,
          delete_after_image_upload: Optional[str] = None,
          instance_id: Optional[str] = None,
          target_oss_region_id: Optional[str] = None)
func NewImage(ctx *Context, name string, args ImageArgs, opts ...ResourceOption) (*Image, error)
public Image(string name, ImageArgs args, CustomResourceOptions? opts = null)
public Image(String name, ImageArgs args)
public Image(String name, ImageArgs args, CustomResourceOptions options)
type: alicloud:ens:Image
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. ImageArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. ImageArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. ImageArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. ImageArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ImageArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var exampleimageResourceResourceFromEnsimage = new AliCloud.Ens.Image("exampleimageResourceResourceFromEnsimage", new()
{
    ImageName = "string",
    DeleteAfterImageUpload = "string",
    InstanceId = "string",
    TargetOssRegionId = "string",
});
Copy
example, err := ens.NewImage(ctx, "exampleimageResourceResourceFromEnsimage", &ens.ImageArgs{
	ImageName:              pulumi.String("string"),
	DeleteAfterImageUpload: pulumi.String("string"),
	InstanceId:             pulumi.String("string"),
	TargetOssRegionId:      pulumi.String("string"),
})
Copy
var exampleimageResourceResourceFromEnsimage = new Image("exampleimageResourceResourceFromEnsimage", ImageArgs.builder()
    .imageName("string")
    .deleteAfterImageUpload("string")
    .instanceId("string")
    .targetOssRegionId("string")
    .build());
Copy
exampleimage_resource_resource_from_ensimage = alicloud.ens.Image("exampleimageResourceResourceFromEnsimage",
    image_name="string",
    delete_after_image_upload="string",
    instance_id="string",
    target_oss_region_id="string")
Copy
const exampleimageResourceResourceFromEnsimage = new alicloud.ens.Image("exampleimageResourceResourceFromEnsimage", {
    imageName: "string",
    deleteAfterImageUpload: "string",
    instanceId: "string",
    targetOssRegionId: "string",
});
Copy
type: alicloud:ens:Image
properties:
    deleteAfterImageUpload: string
    imageName: string
    instanceId: string
    targetOssRegionId: string
Copy

Image Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The Image resource accepts the following input properties:

ImageName This property is required. string
The name of the image. The name must be 2 to 128 characters in length. The name can contain letters, digits, colons (:), underscores (), and hyphens (-). It must start with a letter but cannot start with http:// or https://. The name can contain letters, digits, colons (:), underscores (), and hyphens (-).
DeleteAfterImageUpload string
Specifies whether to automatically release the instance after the image is packaged and uploaded. Only image builders are supported. Default value: false. Valid values:
InstanceId Changes to this property will trigger replacement. string
The ID of the instance.
TargetOssRegionId Changes to this property will trigger replacement. string
The region of the target OSS where the image is to be stored.
ImageName This property is required. string
The name of the image. The name must be 2 to 128 characters in length. The name can contain letters, digits, colons (:), underscores (), and hyphens (-). It must start with a letter but cannot start with http:// or https://. The name can contain letters, digits, colons (:), underscores (), and hyphens (-).
DeleteAfterImageUpload string
Specifies whether to automatically release the instance after the image is packaged and uploaded. Only image builders are supported. Default value: false. Valid values:
InstanceId Changes to this property will trigger replacement. string
The ID of the instance.
TargetOssRegionId Changes to this property will trigger replacement. string
The region of the target OSS where the image is to be stored.
imageName This property is required. String
The name of the image. The name must be 2 to 128 characters in length. The name can contain letters, digits, colons (:), underscores (), and hyphens (-). It must start with a letter but cannot start with http:// or https://. The name can contain letters, digits, colons (:), underscores (), and hyphens (-).
deleteAfterImageUpload String
Specifies whether to automatically release the instance after the image is packaged and uploaded. Only image builders are supported. Default value: false. Valid values:
instanceId Changes to this property will trigger replacement. String
The ID of the instance.
targetOssRegionId Changes to this property will trigger replacement. String
The region of the target OSS where the image is to be stored.
imageName This property is required. string
The name of the image. The name must be 2 to 128 characters in length. The name can contain letters, digits, colons (:), underscores (), and hyphens (-). It must start with a letter but cannot start with http:// or https://. The name can contain letters, digits, colons (:), underscores (), and hyphens (-).
deleteAfterImageUpload string
Specifies whether to automatically release the instance after the image is packaged and uploaded. Only image builders are supported. Default value: false. Valid values:
instanceId Changes to this property will trigger replacement. string
The ID of the instance.
targetOssRegionId Changes to this property will trigger replacement. string
The region of the target OSS where the image is to be stored.
image_name This property is required. str
The name of the image. The name must be 2 to 128 characters in length. The name can contain letters, digits, colons (:), underscores (), and hyphens (-). It must start with a letter but cannot start with http:// or https://. The name can contain letters, digits, colons (:), underscores (), and hyphens (-).
delete_after_image_upload str
Specifies whether to automatically release the instance after the image is packaged and uploaded. Only image builders are supported. Default value: false. Valid values:
instance_id Changes to this property will trigger replacement. str
The ID of the instance.
target_oss_region_id Changes to this property will trigger replacement. str
The region of the target OSS where the image is to be stored.
imageName This property is required. String
The name of the image. The name must be 2 to 128 characters in length. The name can contain letters, digits, colons (:), underscores (), and hyphens (-). It must start with a letter but cannot start with http:// or https://. The name can contain letters, digits, colons (:), underscores (), and hyphens (-).
deleteAfterImageUpload String
Specifies whether to automatically release the instance after the image is packaged and uploaded. Only image builders are supported. Default value: false. Valid values:
instanceId Changes to this property will trigger replacement. String
The ID of the instance.
targetOssRegionId Changes to this property will trigger replacement. String
The region of the target OSS where the image is to be stored.

Outputs

All input properties are implicitly available as output properties. Additionally, the Image resource produces the following output properties:

CreateTime string
The image creation time.
Id string
The provider-assigned unique ID for this managed resource.
Status string
The state of the image.
CreateTime string
The image creation time.
Id string
The provider-assigned unique ID for this managed resource.
Status string
The state of the image.
createTime String
The image creation time.
id String
The provider-assigned unique ID for this managed resource.
status String
The state of the image.
createTime string
The image creation time.
id string
The provider-assigned unique ID for this managed resource.
status string
The state of the image.
create_time str
The image creation time.
id str
The provider-assigned unique ID for this managed resource.
status str
The state of the image.
createTime String
The image creation time.
id String
The provider-assigned unique ID for this managed resource.
status String
The state of the image.

Look up 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): Image
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        create_time: Optional[str] = None,
        delete_after_image_upload: Optional[str] = None,
        image_name: Optional[str] = None,
        instance_id: Optional[str] = None,
        status: Optional[str] = None,
        target_oss_region_id: Optional[str] = None) -> Image
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)
public static Image get(String name, Output<String> id, ImageState state, CustomResourceOptions options)
resources:  _:    type: alicloud:ens:Image    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
CreateTime string
The image creation time.
DeleteAfterImageUpload string
Specifies whether to automatically release the instance after the image is packaged and uploaded. Only image builders are supported. Default value: false. Valid values:
ImageName string
The name of the image. The name must be 2 to 128 characters in length. The name can contain letters, digits, colons (:), underscores (), and hyphens (-). It must start with a letter but cannot start with http:// or https://. The name can contain letters, digits, colons (:), underscores (), and hyphens (-).
InstanceId Changes to this property will trigger replacement. string
The ID of the instance.
Status string
The state of the image.
TargetOssRegionId Changes to this property will trigger replacement. string
The region of the target OSS where the image is to be stored.
CreateTime string
The image creation time.
DeleteAfterImageUpload string
Specifies whether to automatically release the instance after the image is packaged and uploaded. Only image builders are supported. Default value: false. Valid values:
ImageName string
The name of the image. The name must be 2 to 128 characters in length. The name can contain letters, digits, colons (:), underscores (), and hyphens (-). It must start with a letter but cannot start with http:// or https://. The name can contain letters, digits, colons (:), underscores (), and hyphens (-).
InstanceId Changes to this property will trigger replacement. string
The ID of the instance.
Status string
The state of the image.
TargetOssRegionId Changes to this property will trigger replacement. string
The region of the target OSS where the image is to be stored.
createTime String
The image creation time.
deleteAfterImageUpload String
Specifies whether to automatically release the instance after the image is packaged and uploaded. Only image builders are supported. Default value: false. Valid values:
imageName String
The name of the image. The name must be 2 to 128 characters in length. The name can contain letters, digits, colons (:), underscores (), and hyphens (-). It must start with a letter but cannot start with http:// or https://. The name can contain letters, digits, colons (:), underscores (), and hyphens (-).
instanceId Changes to this property will trigger replacement. String
The ID of the instance.
status String
The state of the image.
targetOssRegionId Changes to this property will trigger replacement. String
The region of the target OSS where the image is to be stored.
createTime string
The image creation time.
deleteAfterImageUpload string
Specifies whether to automatically release the instance after the image is packaged and uploaded. Only image builders are supported. Default value: false. Valid values:
imageName string
The name of the image. The name must be 2 to 128 characters in length. The name can contain letters, digits, colons (:), underscores (), and hyphens (-). It must start with a letter but cannot start with http:// or https://. The name can contain letters, digits, colons (:), underscores (), and hyphens (-).
instanceId Changes to this property will trigger replacement. string
The ID of the instance.
status string
The state of the image.
targetOssRegionId Changes to this property will trigger replacement. string
The region of the target OSS where the image is to be stored.
create_time str
The image creation time.
delete_after_image_upload str
Specifies whether to automatically release the instance after the image is packaged and uploaded. Only image builders are supported. Default value: false. Valid values:
image_name str
The name of the image. The name must be 2 to 128 characters in length. The name can contain letters, digits, colons (:), underscores (), and hyphens (-). It must start with a letter but cannot start with http:// or https://. The name can contain letters, digits, colons (:), underscores (), and hyphens (-).
instance_id Changes to this property will trigger replacement. str
The ID of the instance.
status str
The state of the image.
target_oss_region_id Changes to this property will trigger replacement. str
The region of the target OSS where the image is to be stored.
createTime String
The image creation time.
deleteAfterImageUpload String
Specifies whether to automatically release the instance after the image is packaged and uploaded. Only image builders are supported. Default value: false. Valid values:
imageName String
The name of the image. The name must be 2 to 128 characters in length. The name can contain letters, digits, colons (:), underscores (), and hyphens (-). It must start with a letter but cannot start with http:// or https://. The name can contain letters, digits, colons (:), underscores (), and hyphens (-).
instanceId Changes to this property will trigger replacement. String
The ID of the instance.
status String
The state of the image.
targetOssRegionId Changes to this property will trigger replacement. String
The region of the target OSS where the image is to be stored.

Import

ENS Image can be imported using the id, e.g.

$ pulumi import alicloud:ens/image:Image example <id>
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.