Package com.pulumi.alicloud.ecs
Class ImageExport
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.alicloud.ecs.ImageExport
-
public class ImageExport extends com.pulumi.resources.CustomResource
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 ```java 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.ecs.inputs.GetImagesArgs; 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.Instance; import com.pulumi.alicloud.ecs.InstanceArgs; import com.pulumi.alicloud.ecs.Image; import com.pulumi.alicloud.ecs.ImageArgs; import com.pulumi.random.RandomInteger; import com.pulumi.random.RandomIntegerArgs; import com.pulumi.alicloud.oss.Bucket; import com.pulumi.alicloud.oss.BucketArgs; import com.pulumi.alicloud.ecs.ImageExport; import com.pulumi.alicloud.ecs.ImageExportArgs; 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 defaultZones = AlicloudFunctions.getZones(GetZonesArgs.builder() .availableResourceCreation("Instance") .build()); final var defaultInstanceTypes = EcsFunctions.getInstanceTypes(GetInstanceTypesArgs.builder() .instanceTypeFamily("ecs.sn1ne") .build()); final var defaultImages = EcsFunctions.getImages(GetImagesArgs.builder() .nameRegex("^ubuntu_[0-9]+_[0-9]+_x64*") .owners("system") .build()); var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder() .vpcName("terraform-example") .cidrBlock("172.17.3.0/24") .build()); var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder() .vswitchName("terraform-example") .cidrBlock("172.17.3.0/24") .vpcId(defaultNetwork.id()) .zoneId(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id())) .build()); var defaultSecurityGroup = new SecurityGroup("defaultSecurityGroup", SecurityGroupArgs.builder() .vpcId(defaultNetwork.id()) .build()); var defaultInstance = new Instance("defaultInstance", InstanceArgs.builder() .availabilityZone(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id())) .instanceName("terraform-example") .securityGroups(defaultSecurityGroup.id()) .vswitchId(defaultSwitch.id()) .instanceType(defaultInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.ids()[0])) .imageId(defaultImages.applyValue(getImagesResult -> getImagesResult.ids()[0])) .internetMaxBandwidthOut(10) .build()); var defaultImage = new Image("defaultImage", ImageArgs.builder() .instanceId(defaultInstance.id()) .imageName("terraform-example") .description("terraform-example") .build()); var defaultRandomInteger = new RandomInteger("defaultRandomInteger", RandomIntegerArgs.builder() .max(99999) .min(10000) .build()); var defaultBucket = new Bucket("defaultBucket", BucketArgs.builder() .bucket(defaultRandomInteger.result().applyValue(result -> String.format("example-value-%s", result))) .build()); var defaultImageExport = new ImageExport("defaultImageExport", ImageExportArgs.builder() .imageId(defaultImage.id()) .ossBucket(defaultBucket.id()) .ossPrefix("ecsExport") .build()); } } ``` ## Attributes Reference0 The following attributes are exported: * `id` - ID of the image.
-
-
Constructor Summary
Constructors Constructor Description ImageExport(java.lang.String name)
ImageExport(java.lang.String name, ImageExportArgs args)
ImageExport(java.lang.String name, ImageExportArgs args, com.pulumi.resources.CustomResourceOptions options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ImageExport
get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, ImageExportState state, com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.com.pulumi.core.Output<java.lang.String>
imageId()
com.pulumi.core.Output<java.lang.String>
ossBucket()
com.pulumi.core.Output<java.util.Optional<java.lang.String>>
ossPrefix()
-
-
-
Constructor Detail
-
ImageExport
public ImageExport(java.lang.String name)
- Parameters:
name
- The _unique_ name of the resulting resource.
-
ImageExport
public ImageExport(java.lang.String name, ImageExportArgs args)
- Parameters:
name
- The _unique_ name of the resulting resource.args
- The arguments to use to populate this resource's properties.
-
ImageExport
public ImageExport(java.lang.String name, ImageExportArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options)
- Parameters:
name
- The _unique_ name of the resulting resource.args
- The arguments to use to populate this resource's properties.options
- A bag of options that control this resource's behavior.
-
-
Method Detail
-
imageId
public com.pulumi.core.Output<java.lang.String> imageId()
- Returns:
- The source image ID.
-
ossBucket
public com.pulumi.core.Output<java.lang.String> ossBucket()
- Returns:
- Save the exported OSS bucket.
-
ossPrefix
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> ossPrefix()
- Returns:
- The prefix of your OSS Object. It can be composed of numbers or letters, and the character length is 1 ~ 30.
-
get
public static ImageExport get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable ImageExportState state, @Nullable com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.- Parameters:
name
- The _unique_ name of the resulting resource.id
- The _unique_ provider ID of the resource to lookup.state
-options
- Optional settings to control the behavior of the CustomResource.
-
-