getImages

This data source provides available image resources. It contains user's private images, system images provided by Alibaba Cloud, other public images and the ones available on the image market.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const imagesDs = alicloud.ecs.getImages({
owners: "system",
nameRegex: "^centos_6",
});
export const firstImageId = imagesDs.then(imagesDs => imagesDs.images?.[0]?.id);
import pulumi
import pulumi_alicloud as alicloud
images_ds = alicloud.ecs.get_images(owners="system",
name_regex="^centos_6")
pulumi.export("firstImageId", images_ds.images[0].id)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var imagesDs = AliCloud.Ecs.GetImages.Invoke(new()
{
Owners = "system",
NameRegex = "^centos_6",
});
return new Dictionary<string, object?>
{
["firstImageId"] = imagesDs&#46;Apply(getImagesResult => getImagesResult&#46;Images[0]?.Id),
};
});
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
imagesDs, err := ecs.GetImages(ctx, &ecs.GetImagesArgs{
Owners: pulumi.StringRef("system"),
NameRegex: pulumi.StringRef("^centos_6"),
}, nil)
if err != nil {
return err
}
ctx.Export("firstImageId", imagesDs.Images[0].Id)
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.ecs.EcsFunctions;
import com.pulumi.alicloud.ecs.inputs.GetImagesArgs;
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 imagesDs = EcsFunctions.getImages(GetImagesArgs.builder()
.owners("system")
.nameRegex("^centos_6")
.build());
ctx.export("firstImageId", imagesDs.applyValue(getImagesResult -> getImagesResult.images()[0].id()));
}
}
variables:
imagesDs:
fn::invoke:
function: alicloud:ecs:getImages
arguments:
owners: system
nameRegex: ^centos_6
outputs:
firstImageId: ${imagesDs.images[0].id}

Return

A collection of values returned by getImages.

Parameters

argument

A collection of arguments for invoking getImages.


suspend fun getImages(actionType: String? = null, architecture: String? = null, dryRun: Boolean? = null, imageFamily: String? = null, imageId: String? = null, imageName: String? = null, imageOwnerId: String? = null, instanceType: String? = null, isSupportCloudInit: Boolean? = null, isSupportIoOptimized: Boolean? = null, mostRecent: Boolean? = null, nameRegex: String? = null, osType: String? = null, outputFile: String? = null, owners: String? = null, resourceGroupId: String? = null, snapshotId: String? = null, status: String? = null, tags: Map<String, String>? = null, usage: String? = null): GetImagesResult

Return

A collection of values returned by getImages.

Parameters

actionType

The scenario in which the image will be used. Default value: CreateEcs. Valid values:

  • CreateEcs: instance creation.

  • ChangeOS: replacement of the system disk or operating system.

architecture

The image architecture. Valid values: i386 and x86_64.

dryRun

Specifies whether the image is running on an ECS instance. Default value: false. Valid values:

imageFamily

The name of the image family. You can set this parameter to query images of the specified image family. This parameter is empty by default.

imageId

The ID of the image.

imageName

The name of the image.

imageOwnerId

The ID of the Alibaba Cloud account to which the image belongs. This parameter takes effect only when you query shared images or community images.

instanceType

The instance type for which the image can be used.

isSupportCloudInit

Specifies whether the image supports cloud-init.

isSupportIoOptimized

Specifies whether the image can be used on I/O optimized instances.

mostRecent

If more than one result are returned, select the most recent one.

nameRegex

A regex string to filter resulting images by name.

osType

The operating system type of the image. Valid values: windows and linux.

outputFile

File name where to save data source results (after running pulumi preview).

NOTE: At least one of the name_regex, most_recent and owners must be set.

owners

Filter results by a specific image owner. Valid items are system, self, others, marketplace.

resourceGroupId

The ID of the resource group to which the custom image belongs.

snapshotId

The ID of the snapshot used to create the custom image.

status

The status of the image. The following values are available, Separate multiple parameter values by using commas (,). Default value: Available. Valid values:

  • Creating: The image is being created.

  • Waiting: The image is waiting to be processed.

  • Available: The image is available.

  • UnAvailable: The image is unavailable.

  • CreateFailed: The image failed to be created.

  • Deprecated: The image is discontinued.

tags

A mapping of tags to assign to the resource.

usage

Specifies whether to check the validity of the request without actually making the request. Valid values:

See also


suspend fun getImages(argument: suspend GetImagesPlainArgsBuilder.() -> Unit): GetImagesResult

Return

A collection of values returned by getImages.

Parameters

argument

Builder for com.pulumi.alicloud.ecs.kotlin.inputs.GetImagesPlainArgs.

See also