get Ami
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
A collection of arguments for invoking getAmi.
Deprecated
aws.getAmi has been deprecated in favor of aws.ec2.getAmi
Return
A collection of values returned by getAmi.
Parameters
Limit search to users with explicit launch permission on the image. Valid items are the numeric account ID or self
.
One or more name/value pairs to filter off of. There are several valid keys, for a full reference, check out 1.
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.
If more than one result is returned, use the most recent AMI.
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.
NOTE: If more or less than a single match is returned by the search, this call will fail. Ensure that your search is specific enough to return a single AMI ID only, or use
most_recent
to choose the most recent one. If you want to match multiple AMIs, use theaws.ec2.getAmiIds
data source instead.
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
).
Any tags assigned to the image.
tags.#.key
- Key name of the tag.tags.#.value
- Value of the tag.
See also
Deprecated
aws.getAmi has been deprecated in favor of aws.ec2.getAmi
Return
A collection of values returned by getAmi.
Parameters
Builder for com.pulumi.aws.kotlin.inputs.GetAmiPlainArgs.