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.GetAmiIds.InvokeAsync(new Aws.GetAmiIdsArgs
        {
            Filters = 
            {
                new Aws.Inputs.GetAmiIdsFilterArgs
                {
                    Name = "name",
                    Values = 
                    {
                        "ubuntu/images/ubuntu-*-*-amd64-server-*",
                    },
                },
            },
            Owners = 
            {
                "099720109477",
            },
        }));
    }

}
package main

import (
    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

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

ubuntu = aws.get_ami_ids(filters=[{
        "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.getAmiIds({
    filters: [{
        name: "name",
        values: ["ubuntu/images/ubuntu-*-*-amd64-server-*"],
    }],
    owners: ["099720109477"],
}, { async: true }));

Using GetAmiIds

function getAmiIds(args: GetAmiIdsArgs, opts?: InvokeOptions): Promise<GetAmiIdsResult>
function  get_ami_ids(executable_users=None, filters=None, name_regex=None, owners=None, sort_ascending=None, opts=None)
func GetAmiIds(ctx *Context, args *GetAmiIdsArgs, opts ...InvokeOption) (*GetAmiIdsResult, error)
public static class GetAmiIds {
    public static Task<GetAmiIdsResult> InvokeAsync(GetAmiIdsArgs args, InvokeOptions? opts = null)
}

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<GetAmiIdsFilterArgs>

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 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 List[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 List[str]

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].

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.

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 string[]
owners string[]
executableUsers string[]
filters GetAmiIdsFilter[]
nameRegex string
sortAscending boolean
id str

The provider-assigned unique ID for this managed resource.

ids List[str]
owners List[str]
executable_users List[str]
filters List[GetAmiIdsFilter]
name_regex str
sort_ascending bool

Supporting Types

GetAmiIdsFilter

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

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

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.