AWS Classic

Pulumi Official
Package maintained by Pulumi
v5.9.1 published on Tuesday, Jun 21, 2022 by Pulumi

getAmiIds

Deprecated:

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

Use this data source to get a list of AMI IDs matching the specified criteria.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var ubuntu = Output.Create(Aws.Ec2.GetAmiIds.InvokeAsync(new Aws.Ec2.GetAmiIdsArgs
        {
            Filters = 
            {
                new Aws.Ec2.Inputs.GetAmiIdsFilterArgs
                {
                    Name = "name",
                    Values = 
                    {
                        "ubuntu/images/ubuntu-*-*-amd64-server-*",
                    },
                },
            },
            Owners = 
            {
                "099720109477",
            },
        }));
    }

}
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/ec2"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ec2.GetAmiIds(ctx, &ec2.GetAmiIdsArgs{
			Filters: []ec2.GetAmiIdsFilter{
				ec2.GetAmiIdsFilter{
					Name: "name",
					Values: []string{
						"ubuntu/images/ubuntu-*-*-amd64-server-*",
					},
				},
			},
			Owners: []string{
				"099720109477",
			},
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var ubuntu = Output.of(Ec2Functions.getAmiIds(GetAmiIdsArgs.builder()
            .filters(GetAmiIdsFilterArgs.builder()
                .name("name")
                .values("ubuntu/images/ubuntu-*-*-amd64-server-*")
                .build())
            .owners("099720109477")
            .build()));

    }
}
import pulumi
import pulumi_aws as aws

ubuntu = aws.ec2.get_ami_ids(filters=[aws.ec2.GetAmiIdsFilterArgs(
        name="name",
        values=["ubuntu/images/ubuntu-*-*-amd64-server-*"],
    )],
    owners=["099720109477"])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const ubuntu = pulumi.output(aws.ec2.getAmiIds({
    filters: [{
        name: "name",
        values: ["ubuntu/images/ubuntu-*-*-amd64-server-*"],
    }],
    owners: ["099720109477"],
}));
variables:
  ubuntu:
    Fn::Invoke:
      Function: aws:ec2:getAmiIds
      Arguments:
        filters:
          - name: name
            values:
              - ubuntu/images/ubuntu-*-*-amd64-server-*
        owners:
          - 099720109477

Using getAmiIds

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getAmiIds(args: GetAmiIdsArgs, opts?: InvokeOptions): Promise<GetAmiIdsResult>
function getAmiIdsOutput(args: GetAmiIdsOutputArgs, opts?: InvokeOptions): Output<GetAmiIdsResult>
def get_ami_ids(executable_users: Optional[Sequence[str]] = None,
                filters: Optional[Sequence[GetAmiIdsFilter]] = None,
                name_regex: Optional[str] = None,
                owners: Optional[Sequence[str]] = None,
                sort_ascending: Optional[bool] = None,
                opts: Optional[InvokeOptions] = None) -> GetAmiIdsResult
def get_ami_ids_output(executable_users: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetAmiIdsFilterArgs]]]] = None,
                name_regex: Optional[pulumi.Input[str]] = None,
                owners: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                sort_ascending: Optional[pulumi.Input[bool]] = None,
                opts: Optional[InvokeOptions] = None) -> Output[GetAmiIdsResult]
func GetAmiIds(ctx *Context, args *GetAmiIdsArgs, opts ...InvokeOption) (*GetAmiIdsResult, error)
func GetAmiIdsOutput(ctx *Context, args *GetAmiIdsOutputArgs, opts ...InvokeOption) GetAmiIdsResultOutput

> Note: This function is named GetAmiIds in the Go SDK.

public static class GetAmiIds 
{
    public static Task<GetAmiIdsResult> InvokeAsync(GetAmiIdsArgs args, InvokeOptions? opts = null)
    public static Output<GetAmiIdsResult> Invoke(GetAmiIdsInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetAmiIdsResult> getAmiIds(GetAmiIdsArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: aws:index/getAmiIds:getAmiIds
  Arguments:
    # Arguments dictionary

The following arguments are supported:

Owners List<string>

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

ExecutableUsers List<string>

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

Filters List<GetAmiIdsFilter>

One or more name/value pairs to filter off of. There are several valid keys, for a full reference, check out [describe-images in the AWS CLI reference][1].

NameRegex string

A 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. It is recommended to combine this with other options to narrow down the list AWS returns.

SortAscending bool

Used to sort AMIs by creation time.

Owners []string

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

ExecutableUsers []string

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

Filters []GetAmiIdsFilter

One or more name/value pairs to filter off of. There are several valid keys, for a full reference, check out [describe-images in the AWS CLI reference][1].

NameRegex string

A 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. It is recommended to combine this with other options to narrow down the list AWS returns.

SortAscending bool

Used to sort AMIs by creation time.

owners List<String>

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

executableUsers List<String>

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

filters List<GetAmiIdsFilter>

One or more name/value pairs to filter off of. There are several valid keys, for a full reference, check out [describe-images in the AWS CLI reference][1].

nameRegex String

A 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. It is recommended to combine this with other options to narrow down the list AWS returns.

sortAscending Boolean

Used to sort AMIs by creation time.

owners string[]

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

executableUsers string[]

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

filters GetAmiIdsFilter[]

One or more name/value pairs to filter off of. There are several valid keys, for a full reference, check out [describe-images in the AWS CLI reference][1].

nameRegex string

A 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. It is recommended to combine this with other options to narrow down the list AWS returns.

sortAscending boolean

Used to sort AMIs by creation time.

owners Sequence[str]

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

executable_users Sequence[str]

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

filters Sequence[GetAmiIdsFilter]

One or more name/value pairs to filter off of. There are several valid keys, for a full reference, check out [describe-images in the AWS CLI reference][1].

name_regex str

A 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. It is recommended to combine this with other options to narrow down the list AWS returns.

sort_ascending bool

Used to sort AMIs by creation time.

owners List<String>

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

executableUsers List<String>

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

filters List<Property Map>

One or more name/value pairs to filter off of. There are several valid keys, for a full reference, check out [describe-images in the AWS CLI reference][1].

nameRegex String

A 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. It is recommended to combine this with other options to narrow down the list AWS returns.

sortAscending Boolean

Used to sort AMIs by creation time.

getAmiIds Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

Ids List<string>
Owners List<string>
ExecutableUsers List<string>
Filters List<GetAmiIdsFilter>
NameRegex string
SortAscending bool
Id string

The provider-assigned unique ID for this managed resource.

Ids []string
Owners []string
ExecutableUsers []string
Filters []GetAmiIdsFilter
NameRegex string
SortAscending bool
id String

The provider-assigned unique ID for this managed resource.

ids List<String>
owners List<String>
executableUsers List<String>
filters List<GetAmiIdsFilter>
nameRegex String
sortAscending Boolean
id string

The provider-assigned unique ID for this managed resource.

ids string[]
owners string[]
executableUsers string[]
filters GetAmiIdsFilter[]
nameRegex string
sortAscending boolean
id str

The provider-assigned unique ID for this managed resource.

ids Sequence[str]
owners Sequence[str]
executable_users Sequence[str]
filters Sequence[GetAmiIdsFilter]
name_regex str
sort_ascending bool
id String

The provider-assigned unique ID for this managed resource.

ids List<String>
owners List<String>
executableUsers List<String>
filters List<Property Map>
nameRegex String
sortAscending Boolean

Supporting Types

GetAmiIdsFilter

Name string
Values List<string>
Name string
Values []string
name String
values List<String>
name string
values string[]
name str
values Sequence[str]
name String
values List<String>

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.