getAmi

suspend fun getAmi(argument: GetAmiPlainArgs): GetAmiResult

Deprecated

aws.getAmi has been deprecated in favor of aws.ec2.getAmi

Use this data source to get the ID of a registered AMI for use in other resources.

Example Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.Ec2Functions;
import com.pulumi.aws.ec2.inputs.GetAmiArgs;
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 example = Ec2Functions.getAmi(GetAmiArgs.builder()
.executableUsers("self")
.filters(
GetAmiFilterArgs.builder()
.name("name")
.values("myami-*")
.build(),
GetAmiFilterArgs.builder()
.name("root-device-type")
.values("ebs")
.build(),
GetAmiFilterArgs.builder()
.name("virtualization-type")
.values("hvm")
.build())
.mostRecent(true)
.nameRegex("^myami-\\d{3}")
.owners("self")
.build());
}
}

Return

A collection of values returned by getAmi.

Parameters

argument

A collection of arguments for invoking getAmi.


suspend fun getAmi(executableUsers: List<String>? = null, filters: List<GetAmiFilter>? = null, includeDeprecated: Boolean? = null, mostRecent: Boolean? = null, nameRegex: String? = null, owners: List<String>? = null, tags: Map<String, String>? = null): GetAmiResult

Deprecated

aws.getAmi has been deprecated in favor of aws.ec2.getAmi

Return

A collection of values returned by getAmi.

See also

Parameters

executableUsers

Limit search to users with explicit launch permission on the image. Valid items are the numeric account ID or self.

filters

One or more name/value pairs to filter off of. There are several valid keys, for a full reference, check out 1.

includeDeprecated

If true, all deprecated AMIs are included in the response. If false, no deprecated AMIs are included in the response. If no value is specified, the default value is false.

mostRecent

If more than one result is returned, use the most recent AMI.

nameRegex

Regex string to apply to the AMI list returned by AWS. This allows more advanced filtering not supported from the AWS API. This filtering is done locally on what AWS returns, and could have a performance impact if the result is large. Combine this with other options to narrow down the list AWS returns.

owners

List of AMI owners to limit search. Valid values: an AWS account ID, self (the current account), or an AWS owner alias (e.g., amazon, aws-marketplace, microsoft).

tags

Any tags assigned to the image.

  • tags.#.key - Key name of the tag.

  • tags.#.value - Value of the tag.


suspend fun getAmi(argument: suspend GetAmiPlainArgsBuilder.() -> Unit): GetAmiResult

Deprecated

aws.getAmi has been deprecated in favor of aws.ec2.getAmi

Return

A collection of values returned by getAmi.

See also

Parameters

argument

Builder for com.pulumi.aws.kotlin.inputs.GetAmiPlainArgs.