Show / Hide Table of Contents

Namespace Pulumi.AliCloud.Ecs

Classes

AutoProvisioningGroup

Provides a ECS auto provisioning group resource which is a solution that uses preemptive instances and pay_as_you_go instances to rapidly deploy clusters.

NOTE: Available in 1.79.0+

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
public MyStack()
{
    var config = new Config();
    var name = config.Get("name") ?? "auto_provisioning_group";
    var defaultZones = Output.Create(AliCloud.GetZones.InvokeAsync(new AliCloud.GetZonesArgs
    {
        AvailableDiskCategory = "cloud_efficiency",
        AvailableResourceCreation = "VSwitch",
    }));
    var defaultNetwork = new AliCloud.Vpc.Network("defaultNetwork", new AliCloud.Vpc.NetworkArgs
    {
        CidrBlock = "172.16.0.0/16",
    });
    var defaultSwitch = new AliCloud.Vpc.Switch("defaultSwitch", new AliCloud.Vpc.SwitchArgs
    {
        AvailabilityZone = defaultZones.Apply(defaultZones => defaultZones.Zones[0].Id),
        CidrBlock = "172.16.0.0/24",
        VpcId = defaultNetwork.Id,
    });
    var defaultSecurityGroup = new AliCloud.Ecs.SecurityGroup("defaultSecurityGroup", new AliCloud.Ecs.SecurityGroupArgs
    {
        VpcId = defaultNetwork.Id,
    });
    var defaultImages = Output.Create(AliCloud.Ecs.GetImages.InvokeAsync(new AliCloud.Ecs.GetImagesArgs
    {
        MostRecent = true,
        NameRegex = "^ubuntu_18.*64",
        Owners = "system",
    }));
    var template = new AliCloud.Ecs.LaunchTemplate("template", new AliCloud.Ecs.LaunchTemplateArgs
    {
        ImageId = defaultImages.Apply(defaultImages => defaultImages.Images[0].Id),
        InstanceType = "ecs.n1.tiny",
        SecurityGroupId = defaultSecurityGroup.Id,
    });
    var defaultAutoProvisioningGroup = new AliCloud.Ecs.AutoProvisioningGroup("defaultAutoProvisioningGroup", new AliCloud.Ecs.AutoProvisioningGroupArgs
    {
        LaunchTemplateConfigs = 
        {
            new AliCloud.Ecs.Inputs.AutoProvisioningGroupLaunchTemplateConfigArgs
            {
                InstanceType = "ecs.n1.small",
                VswitchId = defaultSwitch.Id,
            },
        },
        LaunchTemplateId = template.Id,
        PayAsYouGoTargetCapacity = "1",
        SpotTargetCapacity = "2",
        TotalTargetCapacity = "4",
    });
}

}

Block config

The config mapping supports the following:

  • instance_type - (Optional) The instance type of the Nth extended configurations of the launch template.
  • max_price - (Required) The maximum price of the instance type specified in the Nth extended configurations of the launch template.
  • vswitch_id - (Required) The ID of the VSwitch in the Nth extended configurations of the launch template.
  • weighted_capacity - (Optional) The weight of the instance type specified in the Nth extended configurations of the launch template.
  • priority - (Optional) The priority of the instance type specified in the Nth extended configurations of the launch template. A value of 0 indicates the highest priority.

AutoProvisioningGroupArgs

AutoProvisioningGroupState

CopyImage

CopyImageArgs

CopyImageState

Disk

DiskArgs

DiskAttachment

Provides an Alicloud ECS Disk Attachment as a resource, to attach and detach disks from ECS Instances.

DiskAttachmentArgs

DiskAttachmentState

DiskState

Eip

EipArgs

EipAssociation

EipAssociationArgs

EipAssociationState

EipState

GetDisks

GetDisksArgs

GetDisksResult

GetEips

GetEipsArgs

GetEipsResult

GetImages

GetImagesArgs

GetImagesResult

GetInstances

GetInstancesArgs

GetInstancesResult

GetInstanceTypeFamilies

GetInstanceTypeFamiliesArgs

GetInstanceTypeFamiliesResult

GetInstanceTypes

GetInstanceTypesArgs

GetInstanceTypesResult

GetKeyPairs

GetKeyPairsArgs

GetKeyPairsResult

GetNetworkInterfaces

GetNetworkInterfacesArgs

GetNetworkInterfacesResult

GetSecurityGroupRules

GetSecurityGroupRulesArgs

GetSecurityGroupRulesResult

GetSecurityGroups

GetSecurityGroupsArgs

GetSecurityGroupsResult

GetSnapshots

GetSnapshotsArgs

GetSnapshotsResult

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

}

ImageArgs

ImageCopy

Copies a custom image from one region to another. You can use copied images to perform operations in the target region, such as creating instances (RunInstances) and replacing system disks (ReplaceSystemDisk).

NOTE: You can only copy the custom image when it is in the Available state.

NOTE: You can only copy the image belonging to your Alibaba Cloud account. Images cannot be copied from one account to another.

NOTE: If the copying is not completed, you cannot call DeleteImage to delete the image but you can call CancelCopyImage to cancel the copying.

NOTE: Available in 1.66.0+.

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
public MyStack()
{
    var @default = new AliCloud.Ecs.ImageCopy("default", new AliCloud.Ecs.ImageCopyArgs
    {
        Description = "test-image",
        ImageName = "test-image",
        SourceImageId = "m-bp1gxyhdswlsn18tu***",
        SourceRegionId = "cn-hangzhou",
        Tags = 
        {
            { "FinanceDept", "FinanceDeptJoshua" },
        },
    });
}

}

ImageCopyArgs

ImageCopyState

ImageExport

Export a custom image to the OSS bucket in the same region as the custom image.

NOTE: If you create an ECS instance using a mirror image and create a system disk snapshot again, exporting a custom image created from the system disk snapshot is not supported.

NOTE: Support for exporting custom images that include data disk snapshot information in the image. The number of data disks cannot exceed 4 and the maximum capacity of a single data disk cannot exceed 500 GiB.

NOTE: Before exporting the image, you must authorize the cloud server ECS official service account to write OSS permissions through RAM.

NOTE: Available in 1.68.0+.

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
public MyStack()
{
    var @default = new AliCloud.Ecs.ImageExport("default", new AliCloud.Ecs.ImageExportArgs
    {
        ImageId = "m-bp1gxy***",
        OssBucket = "ecsimageexportconfig",
        OssPrefix = "ecsExport",
    });
}

}

ImageExportArgs

ImageExportState

ImageImport

Import a copy of your local on-premise file to ECS, and appear as a custom replacement in the corresponding domain.

NOTE: You must upload the image file to the object storage OSS in advance.

NOTE: The region where the image is imported must be the same region as the OSS bucket where the image file is uploaded.

NOTE: Available in 1.69.0+.

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
public MyStack()
{
    var @this = new AliCloud.Ecs.ImageImport("this", new AliCloud.Ecs.ImageImportArgs
    {
        Architecture = "x86_64",
        Description = "test import image",
        DiskDeviceMappings = 
        {
            new AliCloud.Ecs.Inputs.ImageImportDiskDeviceMappingArgs
            {
                DiskImageSize = 5,
                OssBucket = "testimportimage",
                OssObject = "root.img",
            },
        },
        ImageName = "test-import-image",
        LicenseType = "Auto",
        OsType = "linux",
        Platform = "Ubuntu",
    });
}

}

ImageImportArgs

ImageImportState

ImageSharePermission

Manage image sharing permissions. You can share your custom image to other Alibaba Cloud users. The user can use the shared custom image to create ECS instances or replace the system disk of the instance.

NOTE: You can only share your own custom images to other Alibaba Cloud users.

NOTE: Each custom image can be shared with up to 50 Alibaba Cloud accounts. You can submit a ticket to share with more users.

NOTE: After creating an ECS instance using a shared image, once the custom image owner releases the image sharing relationship or deletes the custom image, the instance cannot initialize the system disk.

NOTE: Available in 1.68.0+.

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
public MyStack()
{
    var @default = new AliCloud.Ecs.ImageSharePermission("default", new AliCloud.Ecs.ImageSharePermissionArgs
    {
        AccountId = "1234567890",
        ImageId = "m-bp1gxyh***",
    });
}

}

ImageSharePermissionArgs

ImageSharePermissionState

ImageState

Instance

InstanceArgs

InstanceState

KeyPair

KeyPairArgs

KeyPairAttachment

Provides a key pair attachment resource to bind key pair for several ECS instances.

NOTE: After the key pair is attached with sone instances, there instances must be rebooted to make the key pair affect.

Example Usage

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
public MyStack()
{
    var @default = Output.Create(AliCloud.GetZones.InvokeAsync(new AliCloud.GetZonesArgs
    {
        AvailableDiskCategory = "cloud_ssd",
        AvailableResourceCreation = "VSwitch",
    }));
    var type = @default.Apply(@default => Output.Create(AliCloud.Ecs.GetInstanceTypes.InvokeAsync(new AliCloud.Ecs.GetInstanceTypesArgs
    {
        AvailabilityZone = @default.Zones[0].Id,
        CpuCoreCount = 1,
        MemorySize = 2,
    })));
    var images = Output.Create(AliCloud.Ecs.GetImages.InvokeAsync(new AliCloud.Ecs.GetImagesArgs
    {
        MostRecent = true,
        NameRegex = "^ubuntu_18.*64",
        Owners = "system",
    }));
    var config = new Config();
    var name = config.Get("name") ?? "keyPairAttachmentName";
    var vpc = new AliCloud.Vpc.Network("vpc", new AliCloud.Vpc.NetworkArgs
    {
        CidrBlock = "10.1.0.0/21",
    });
    var vswitch = new AliCloud.Vpc.Switch("vswitch", new AliCloud.Vpc.SwitchArgs
    {
        AvailabilityZone = @default.Apply(@default => @default.Zones[0].Id),
        CidrBlock = "10.1.1.0/24",
        VpcId = vpc.Id,
    });
    var @group = new AliCloud.Ecs.SecurityGroup("group", new AliCloud.Ecs.SecurityGroupArgs
    {
        Description = "New security group",
        VpcId = vpc.Id,
    });
    var instance = new List<AliCloud.Ecs.Instance>();
    for (var rangeIndex = 0; rangeIndex < 2; rangeIndex++)
    {
        var range = new { Value = rangeIndex };
        instance.Add(new AliCloud.Ecs.Instance($"instance-{range.Value}", new AliCloud.Ecs.InstanceArgs
        {
            ImageId = images.Apply(images => images.Images[0].Id),
            InstanceChargeType = "PostPaid",
            InstanceName = $"{name}-{range.Value + 1}",
            InstanceType = type.Apply(type => type.InstanceTypes[0].Id),
            InternetChargeType = "PayByTraffic",
            InternetMaxBandwidthOut = 5,
            Password = "Test12345",
            SecurityGroups = 
            {
                @group.Id,
            },
            SystemDiskCategory = "cloud_ssd",
            VswitchId = vswitch.Id,
        }));
    }
    var pair = new AliCloud.Ecs.KeyPair("pair", new AliCloud.Ecs.KeyPairArgs
    {
        KeyName = name,
    });
    var attachment = new AliCloud.Ecs.KeyPairAttachment("attachment", new AliCloud.Ecs.KeyPairAttachmentArgs
    {
        InstanceIds = instance.Select(__item => __item.Id).ToList(),
        KeyName = pair.Id,
    });
}

}

KeyPairAttachmentArgs

KeyPairAttachmentState

KeyPairState

LaunchTemplate

Provides an ECS Launch Template resource.

For information about Launch Template and how to use it, see Launch Template.

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
public MyStack()
{
    var images = Output.Create(AliCloud.Ecs.GetImages.InvokeAsync(new AliCloud.Ecs.GetImagesArgs
    {
        Owners = "system",
    }));
    var instances = Output.Create(AliCloud.Ecs.GetInstances.InvokeAsync());
    var template = new AliCloud.Ecs.LaunchTemplate("template", new AliCloud.Ecs.LaunchTemplateArgs
    {
        DataDisks = 
        {
            new AliCloud.Ecs.Inputs.LaunchTemplateDataDiskArgs
            {
                Description = "test1",
                Name = "disk1",
            },
            new AliCloud.Ecs.Inputs.LaunchTemplateDataDiskArgs
            {
                Description = "test2",
                Name = "disk2",
            },
        },
        Description = "test1",
        HostName = "tf-test-host",
        ImageId = images.Apply(images => images.Images[0].Id),
        InstanceChargeType = "PrePaid",
        InstanceName = "tf-instance-name",
        InstanceType = instances.Apply(instances => instances.Instances[0].InstanceType),
        InternetChargeType = "PayByBandwidth",
        InternetMaxBandwidthIn = 5,
        InternetMaxBandwidthOut = 0,
        IoOptimized = "none",
        KeyPairName = "test-key-pair",
        NetworkInterfaces = new AliCloud.Ecs.Inputs.LaunchTemplateNetworkInterfacesArgs
        {
            Description = "hello1",
            Name = "eth0",
            PrimaryIp = "10.0.0.2",
            SecurityGroupId = "xxxx",
            VswitchId = "xxxxxxx",
        },
        NetworkType = "vpc",
        RamRoleName = "xxxxx",
        ResourceGroupId = "rg-zkdfjahg9zxncv0",
        SecurityEnhancementStrategy = "Active",
        SecurityGroupId = "sg-zxcvj0lasdf102350asdf9a",
        SpotPriceLimit = 5,
        SpotStrategy = "SpotWithPriceLimit",
        SystemDiskCategory = "cloud_ssd",
        SystemDiskDescription = "test disk",
        SystemDiskName = "hello",
        SystemDiskSize = 40,
        Tags = 
        {
            { "tag1", "hello" },
            { "tag2", "world" },
        },
        Userdata = "xxxxxxxxxxxxxx",
        VpcId = "vpc-asdfnbg0as8dfk1nb2",
        VswitchId = "sw-ljkngaksdjfj0nnasdf",
        ZoneId = "beijing-a",
    });
}

}

LaunchTemplateArgs

LaunchTemplateState

ReservedInstance

Provides an Reserved Instance resource.

NOTE: Available in 1.65.0+

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
public MyStack()
{
    var @default = new AliCloud.Ecs.ReservedInstance("default", new AliCloud.Ecs.ReservedInstanceArgs
    {
        InstanceType = "ecs.g6.large",
        InstanceAmount = "1",
        PeriodUnit = "Year",
        OfferingType = "All Upfront",
        Description = "ReservedInstance",
        ZoneId = "cn-shanghai-g",
        Scope = "Zone",
        Period = "1",
    });
}

}

ReservedInstanceArgs

ReservedInstanceState

SecurityGroup

SecurityGroupArgs

SecurityGroupRule

SecurityGroupRuleArgs

SecurityGroupRuleState

SecurityGroupState

Snapshot

Provides an ECS snapshot resource.

For information about snapshot and how to use it, see Snapshot.

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
public MyStack()
{
    var snapshot = new AliCloud.Ecs.Snapshot("snapshot", new AliCloud.Ecs.SnapshotArgs
    {
        Description = "this snapshot is created for testing",
        DiskId = alicloud_disk_attachment.Instance_attachment.Disk_id,
        Tags = 
        {
            { "version", "1.2" },
        },
    });
}

}

SnapshotArgs

SnapshotPolicy

Provides an ECS snapshot policy resource.

For information about snapshot policy and how to use it, see Snapshot.

NOTE: Available in 1.42.0+.

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
public MyStack()
{
    var sp = new AliCloud.Ecs.SnapshotPolicy("sp", new AliCloud.Ecs.SnapshotPolicyArgs
    {
        RepeatWeekdays = 
        {
            "1",
            "2",
            "3",
        },
        RetentionDays = -1,
        TimePoints = 
        {
            "1",
            "22",
            "23",
        },
    });
}

}

SnapshotPolicyArgs

SnapshotPolicyState

SnapshotState

Back to top Copyright 2016-2020, Pulumi Corporation.