EcsSnapshotArgs

data class EcsSnapshotArgs(val category: Output<String>? = null, val description: Output<String>? = null, val diskId: Output<String>? = null, val force: Output<Boolean>? = null, val instantAccess: Output<Boolean>? = null, val instantAccessRetentionDays: Output<Int>? = null, val name: Output<String>? = null, val resourceGroupId: Output<String>? = null, val retentionDays: Output<Int>? = null, val snapshotName: Output<String>? = null, val tags: Output<Map<String, Any>>? = null) : ConvertibleToJava<EcsSnapshotArgs>

Provides a ECS Snapshot resource. For information about ECS Snapshot and how to use it, see What is Snapshot.

NOTE: Available in v1.120.0+.

Example Usage

Basic Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.AlicloudFunctions;
import com.pulumi.alicloud.inputs.GetZonesArgs;
import com.pulumi.alicloud.ecs.EcsFunctions;
import com.pulumi.alicloud.ecs.inputs.GetInstanceTypesArgs;
import com.pulumi.alicloud.vpc.Network;
import com.pulumi.alicloud.vpc.NetworkArgs;
import com.pulumi.alicloud.vpc.Switch;
import com.pulumi.alicloud.vpc.SwitchArgs;
import com.pulumi.alicloud.ecs.SecurityGroup;
import com.pulumi.alicloud.ecs.SecurityGroupArgs;
import com.pulumi.alicloud.ecs.EcsDisk;
import com.pulumi.alicloud.ecs.EcsDiskArgs;
import com.pulumi.alicloud.ecs.inputs.GetImagesArgs;
import com.pulumi.alicloud.ecs.Instance;
import com.pulumi.alicloud.ecs.InstanceArgs;
import com.pulumi.alicloud.ecs.EcsDiskAttachment;
import com.pulumi.alicloud.ecs.EcsDiskAttachmentArgs;
import com.pulumi.alicloud.ecs.EcsSnapshot;
import com.pulumi.alicloud.ecs.EcsSnapshotArgs;
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 exampleZones = AlicloudFunctions.getZones(GetZonesArgs.builder()
.availableResourceCreation("Instance")
.build());
final var exampleInstanceTypes = EcsFunctions.getInstanceTypes(GetInstanceTypesArgs.builder()
.availabilityZone(exampleZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
.cpuCoreCount(1)
.memorySize(2)
.build());
var exampleNetwork = new Network("exampleNetwork", NetworkArgs.builder()
.vpcName("terraform-example")
.cidrBlock("172.17.3.0/24")
.build());
var exampleSwitch = new Switch("exampleSwitch", SwitchArgs.builder()
.vswitchName("terraform-example")
.cidrBlock("172.17.3.0/24")
.vpcId(exampleNetwork.id())
.zoneId(exampleZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
.build());
var exampleSecurityGroup = new SecurityGroup("exampleSecurityGroup", SecurityGroupArgs.builder()
.description("New security group")
.vpcId(exampleNetwork.id())
.build());
var exampleEcsDisk = new EcsDisk("exampleEcsDisk", EcsDiskArgs.builder()
.diskName("terraform-example")
.zoneId(exampleInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.instanceTypes()[0].availabilityZones()[0]))
.category("cloud_efficiency")
.size("20")
.build());
final var exampleImages = EcsFunctions.getImages(GetImagesArgs.builder()
.nameRegex("^ubuntu_[0-9]+_[0-9]+_x64*")
.owners("system")
.build());
var exampleInstance = new Instance("exampleInstance", InstanceArgs.builder()
.availabilityZone(exampleZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
.instanceName("terraform-example")
.imageId(exampleImages.applyValue(getImagesResult -> getImagesResult.images()[0].id()))
.instanceType(exampleInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.instanceTypes()[0].id()))
.securityGroups(exampleSecurityGroup.id())
.vswitchId(exampleSwitch.id())
.build());
var exampleEcsDiskAttachment = new EcsDiskAttachment("exampleEcsDiskAttachment", EcsDiskAttachmentArgs.builder()
.diskId(exampleEcsDisk.id())
.instanceId(exampleInstance.id())
.build());
var exampleEcsSnapshot = new EcsSnapshot("exampleEcsSnapshot", EcsSnapshotArgs.builder()
.category("standard")
.description("terraform-example")
.diskId(exampleEcsDisk.id())
.retentionDays("20")
.snapshotName("terraform-example")
.tags(Map.ofEntries(
Map.entry("Created", "TF"),
Map.entry("For", "example")
))
.build());
}
}

Import

ECS Snapshot can be imported using the id, e.g.

$ pulumi import alicloud:ecs/ecsSnapshot:EcsSnapshot example <id>

Constructors

Link copied to clipboard
fun EcsSnapshotArgs(category: Output<String>? = null, description: Output<String>? = null, diskId: Output<String>? = null, force: Output<Boolean>? = null, instantAccess: Output<Boolean>? = null, instantAccessRetentionDays: Output<Int>? = null, name: Output<String>? = null, resourceGroupId: Output<String>? = null, retentionDays: Output<Int>? = null, snapshotName: Output<String>? = null, tags: Output<Map<String, Any>>? = null)

Functions

Link copied to clipboard
open override fun toJava(): EcsSnapshotArgs

Properties

Link copied to clipboard
val category: Output<String>? = null

The category of the snapshot. Valid Values: standard and flash.

Link copied to clipboard
val description: Output<String>? = null

The description of the snapshot.

Link copied to clipboard
val diskId: Output<String>? = null

The ID of the disk.

Link copied to clipboard
val force: Output<Boolean>? = null

Specifies whether to forcibly delete the snapshot that has been used to create disks.

Link copied to clipboard
val instantAccess: Output<Boolean>? = null

Specifies whether to enable the instant access feature.

Link copied to clipboard
val instantAccessRetentionDays: Output<Int>? = null

Specifies the retention period of the instant access feature. After the retention period ends, the snapshot is automatically released.

Link copied to clipboard
val name: Output<String>? = null

Field name has been deprecated from provider version 1.120.0. New field snapshot_name instead.

Link copied to clipboard
val resourceGroupId: Output<String>? = null

The resource group id.

Link copied to clipboard
val retentionDays: Output<Int>? = null

The retention period of the snapshot.

Link copied to clipboard
val snapshotName: Output<String>? = null

The name of the snapshot.

Link copied to clipboard
val tags: Output<Map<String, Any>>? = null

A mapping of tags to assign to the snapshot.