1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. ens
  5. Image
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi

alicloud.ens.Image

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi

    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",
    });
    
    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")
    
    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
    		}
    		_, 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
    	})
    }
    
    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",
        });
    
    });
    
    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());
    
        }
    }
    
    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'
    

    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)
    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 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.
    args 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 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.
    name String
    The unique name of the resource.
    args 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",
    });
    
    example, err := ens.NewImage(ctx, "exampleimageResourceResourceFromEnsimage", &ens.ImageArgs{
    	ImageName:              pulumi.String("string"),
    	DeleteAfterImageUpload: pulumi.String("string"),
    	InstanceId:             pulumi.String("string"),
    })
    
    var exampleimageResourceResourceFromEnsimage = new Image("exampleimageResourceResourceFromEnsimage", ImageArgs.builder()
        .imageName("string")
        .deleteAfterImageUpload("string")
        .instanceId("string")
        .build());
    
    exampleimage_resource_resource_from_ensimage = alicloud.ens.Image("exampleimageResourceResourceFromEnsimage",
        image_name="string",
        delete_after_image_upload="string",
        instance_id="string")
    
    const exampleimageResourceResourceFromEnsimage = new alicloud.ens.Image("exampleimageResourceResourceFromEnsimage", {
        imageName: "string",
        deleteAfterImageUpload: "string",
        instanceId: "string",
    });
    
    type: alicloud:ens:Image
    properties:
        deleteAfterImageUpload: string
        imageName: string
        instanceId: string
    

    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 string
    Image Name.
    DeleteAfterImageUpload string
    Whether the instance is automatically released after the image is packaged and uploaded successfully, only the build machine is supported. Optional values: true: When the instance is released, the image is released together with the instance. false: When the instance is released, the image is retained and is not released together with the instance. Empty means false by default.
    InstanceId string
    The ID of the instance corresponding to the image.
    ImageName string
    Image Name.
    DeleteAfterImageUpload string
    Whether the instance is automatically released after the image is packaged and uploaded successfully, only the build machine is supported. Optional values: true: When the instance is released, the image is released together with the instance. false: When the instance is released, the image is retained and is not released together with the instance. Empty means false by default.
    InstanceId string
    The ID of the instance corresponding to the image.
    imageName String
    Image Name.
    deleteAfterImageUpload String
    Whether the instance is automatically released after the image is packaged and uploaded successfully, only the build machine is supported. Optional values: true: When the instance is released, the image is released together with the instance. false: When the instance is released, the image is retained and is not released together with the instance. Empty means false by default.
    instanceId String
    The ID of the instance corresponding to the image.
    imageName string
    Image Name.
    deleteAfterImageUpload string
    Whether the instance is automatically released after the image is packaged and uploaded successfully, only the build machine is supported. Optional values: true: When the instance is released, the image is released together with the instance. false: When the instance is released, the image is retained and is not released together with the instance. Empty means false by default.
    instanceId string
    The ID of the instance corresponding to the image.
    image_name str
    Image Name.
    delete_after_image_upload str
    Whether the instance is automatically released after the image is packaged and uploaded successfully, only the build machine is supported. Optional values: true: When the instance is released, the image is released together with the instance. false: When the instance is released, the image is retained and is not released together with the instance. Empty means false by default.
    instance_id str
    The ID of the instance corresponding to the image.
    imageName String
    Image Name.
    deleteAfterImageUpload String
    Whether the instance is automatically released after the image is packaged and uploaded successfully, only the build machine is supported. Optional values: true: When the instance is released, the image is released together with the instance. false: When the instance is released, the image is retained and is not released together with the instance. Empty means false by default.
    instanceId String
    The ID of the instance corresponding to the image.

    Outputs

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

    CreateTime string
    Image creation time.
    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    Mirror Status Optional values: Creating: Creating Packing: Packing Uploading: Uploading Pack_failed: Packing failed Upload_failed: Upload failed Available: Only images in the Available state can be used and operated. Unavailable: Not available Copying: Copying.
    CreateTime string
    Image creation time.
    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    Mirror Status Optional values: Creating: Creating Packing: Packing Uploading: Uploading Pack_failed: Packing failed Upload_failed: Upload failed Available: Only images in the Available state can be used and operated. Unavailable: Not available Copying: Copying.
    createTime String
    Image creation time.
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    Mirror Status Optional values: Creating: Creating Packing: Packing Uploading: Uploading Pack_failed: Packing failed Upload_failed: Upload failed Available: Only images in the Available state can be used and operated. Unavailable: Not available Copying: Copying.
    createTime string
    Image creation time.
    id string
    The provider-assigned unique ID for this managed resource.
    status string
    Mirror Status Optional values: Creating: Creating Packing: Packing Uploading: Uploading Pack_failed: Packing failed Upload_failed: Upload failed Available: Only images in the Available state can be used and operated. Unavailable: Not available Copying: Copying.
    create_time str
    Image creation time.
    id str
    The provider-assigned unique ID for this managed resource.
    status str
    Mirror Status Optional values: Creating: Creating Packing: Packing Uploading: Uploading Pack_failed: Packing failed Upload_failed: Upload failed Available: Only images in the Available state can be used and operated. Unavailable: Not available Copying: Copying.
    createTime String
    Image creation time.
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    Mirror Status Optional values: Creating: Creating Packing: Packing Uploading: Uploading Pack_failed: Packing failed Upload_failed: Upload failed Available: Only images in the Available state can be used and operated. Unavailable: Not available Copying: Copying.

    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) -> 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)
    Resource lookup is not supported in YAML
    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.
    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:
    CreateTime string
    Image creation time.
    DeleteAfterImageUpload string
    Whether the instance is automatically released after the image is packaged and uploaded successfully, only the build machine is supported. Optional values: true: When the instance is released, the image is released together with the instance. false: When the instance is released, the image is retained and is not released together with the instance. Empty means false by default.
    ImageName string
    Image Name.
    InstanceId string
    The ID of the instance corresponding to the image.
    Status string
    Mirror Status Optional values: Creating: Creating Packing: Packing Uploading: Uploading Pack_failed: Packing failed Upload_failed: Upload failed Available: Only images in the Available state can be used and operated. Unavailable: Not available Copying: Copying.
    CreateTime string
    Image creation time.
    DeleteAfterImageUpload string
    Whether the instance is automatically released after the image is packaged and uploaded successfully, only the build machine is supported. Optional values: true: When the instance is released, the image is released together with the instance. false: When the instance is released, the image is retained and is not released together with the instance. Empty means false by default.
    ImageName string
    Image Name.
    InstanceId string
    The ID of the instance corresponding to the image.
    Status string
    Mirror Status Optional values: Creating: Creating Packing: Packing Uploading: Uploading Pack_failed: Packing failed Upload_failed: Upload failed Available: Only images in the Available state can be used and operated. Unavailable: Not available Copying: Copying.
    createTime String
    Image creation time.
    deleteAfterImageUpload String
    Whether the instance is automatically released after the image is packaged and uploaded successfully, only the build machine is supported. Optional values: true: When the instance is released, the image is released together with the instance. false: When the instance is released, the image is retained and is not released together with the instance. Empty means false by default.
    imageName String
    Image Name.
    instanceId String
    The ID of the instance corresponding to the image.
    status String
    Mirror Status Optional values: Creating: Creating Packing: Packing Uploading: Uploading Pack_failed: Packing failed Upload_failed: Upload failed Available: Only images in the Available state can be used and operated. Unavailable: Not available Copying: Copying.
    createTime string
    Image creation time.
    deleteAfterImageUpload string
    Whether the instance is automatically released after the image is packaged and uploaded successfully, only the build machine is supported. Optional values: true: When the instance is released, the image is released together with the instance. false: When the instance is released, the image is retained and is not released together with the instance. Empty means false by default.
    imageName string
    Image Name.
    instanceId string
    The ID of the instance corresponding to the image.
    status string
    Mirror Status Optional values: Creating: Creating Packing: Packing Uploading: Uploading Pack_failed: Packing failed Upload_failed: Upload failed Available: Only images in the Available state can be used and operated. Unavailable: Not available Copying: Copying.
    create_time str
    Image creation time.
    delete_after_image_upload str
    Whether the instance is automatically released after the image is packaged and uploaded successfully, only the build machine is supported. Optional values: true: When the instance is released, the image is released together with the instance. false: When the instance is released, the image is retained and is not released together with the instance. Empty means false by default.
    image_name str
    Image Name.
    instance_id str
    The ID of the instance corresponding to the image.
    status str
    Mirror Status Optional values: Creating: Creating Packing: Packing Uploading: Uploading Pack_failed: Packing failed Upload_failed: Upload failed Available: Only images in the Available state can be used and operated. Unavailable: Not available Copying: Copying.
    createTime String
    Image creation time.
    deleteAfterImageUpload String
    Whether the instance is automatically released after the image is packaged and uploaded successfully, only the build machine is supported. Optional values: true: When the instance is released, the image is released together with the instance. false: When the instance is released, the image is retained and is not released together with the instance. Empty means false by default.
    imageName String
    Image Name.
    instanceId String
    The ID of the instance corresponding to the image.
    status String
    Mirror Status Optional values: Creating: Creating Packing: Packing Uploading: Uploading Pack_failed: Packing failed Upload_failed: Upload failed Available: Only images in the Available state can be used and operated. Unavailable: Not available Copying: Copying.

    Import

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

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

    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.
    alicloud logo
    Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi