ImageCache

class ImageCache : KotlinCustomResource

An ECI Image Cache can help user to solve the time-consuming problem of image pull. For information about Alicloud ECI Image Cache and how to use it, see What is Resource Alicloud ECI Image Cache.

NOTE: Available since v1.89.0. NOTE: Each image cache corresponds to a snapshot, and the user does not delete the snapshot directly, otherwise the cache will fail.

Example Usage

Basic Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.eci.EciFunctions;
import com.pulumi.alicloud.eci.inputs.GetZonesArgs;
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.EipAddress;
import com.pulumi.alicloud.ecs.EipAddressArgs;
import com.pulumi.alicloud.AlicloudFunctions;
import com.pulumi.alicloud.inputs.GetRegionsArgs;
import com.pulumi.alicloud.eci.ImageCache;
import com.pulumi.alicloud.eci.ImageCacheArgs;
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("tf-example");
final var defaultZones = EciFunctions.getZones();
var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
.vpcName(name)
.cidrBlock("10.0.0.0/8")
.build());
var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder()
.vswitchName(name)
.cidrBlock("10.1.0.0/16")
.vpcId(defaultNetwork.id())
.zoneId(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[0].zoneIds()[0]))
.build());
var defaultSecurityGroup = new SecurityGroup("defaultSecurityGroup", SecurityGroupArgs.builder()
.vpcId(defaultNetwork.id())
.build());
var defaultEipAddress = new EipAddress("defaultEipAddress", EipAddressArgs.builder()
.isp("BGP")
.addressName(name)
.netmode("public")
.bandwidth("1")
.securityProtectionTypes("AntiDDoS_Enhanced")
.paymentType("PayAsYouGo")
.build());
final var defaultRegions = AlicloudFunctions.getRegions(GetRegionsArgs.builder()
.current(true)
.build());
var defaultImageCache = new ImageCache("defaultImageCache", ImageCacheArgs.builder()
.imageCacheName(name)
.images(String.format("registry-vpc.%s.aliyuncs.com/eci_open/nginx:alpine", defaultRegions.applyValue(getRegionsResult -> getRegionsResult.regions()[0].id())))
.securityGroupId(defaultSecurityGroup.id())
.vswitchId(defaultSwitch.id())
.eipInstanceId(defaultEipAddress.id())
.build());
}
}

Import

ECI Image Cache can be imported using the id, e.g.

$ pulumi import alicloud:eci/imageCache:ImageCache example abc123456

Properties

Link copied to clipboard

The ID of the container group job that is used to create the image cache.

Link copied to clipboard
val eipInstanceId: Output<String>?

The instance ID of the Elastic IP Address (EIP). If you want to pull images from the Internet, you must specify an EIP to make sure that the container group can access the Internet. You can also configure the network address translation (NAT) gateway. We recommend that you configure the NAT gateway for the Internet access. Refer to Public Network Access Method

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val imageCacheName: Output<String>

The name of the image cache.

Link copied to clipboard
val imageCacheSize: Output<Int>?

The size of the image cache. Default to 20. Unit: GiB.

Link copied to clipboard

The Image Registry parameters about the image to be cached. See image_registry_credential below.

Link copied to clipboard
val images: Output<List<String>>

The images to be cached. The image name must be versioned.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val resourceGroupId: Output<String>?

The ID of the resource group.

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

The retention days of the image cache. Once the image cache expires, it will be cleared. By default, the image cache never expires. Note: The image cache that fails to be created is retained for only one day.

Link copied to clipboard
val securityGroupId: Output<String>

The ID of the security group. You do not need to specify the same security group as the container group.

Link copied to clipboard
val status: Output<String>

The status of the image cache.

Link copied to clipboard
val urn: Output<String>
Link copied to clipboard
val vswitchId: Output<String>

The ID of the VSwitch. You do not need to specify the same VSwitch as the container group.

Link copied to clipboard
val zoneId: Output<String>?

The zone id to cache image.