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).- Executable
Users List<string> Limit search to users with explicit launch permission on the image. Valid items are the numeric account ID or
self.- Filters
List<Get
Ami Ids Filter Args> 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 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.
- Sort
Ascending 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).- Executable
Users []string Limit search to users with explicit launch permission on the image. Valid items are the numeric account ID or
self.- Filters
[]Get
Ami Ids Filter 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 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.
- Sort
Ascending 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).- executable
Users string[] Limit search to users with explicit launch permission on the image. Valid items are the numeric account ID or
self.- filters
Get
Ami Ids Filter[] 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 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.
- sort
Ascending 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[Get
Ami Ids Filter] 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>
- Executable
Users List<string> - Filters
List<Get
Ami Ids Filter> - Name
Regex string - Sort
Ascending bool
- Id string
The provider-assigned unique ID for this managed resource.
- Ids []string
- Owners []string
- Executable
Users []string - Filters
[]Get
Ami Ids Filter - Name
Regex string - Sort
Ascending bool
- id string
The provider-assigned unique ID for this managed resource.
- ids string[]
- owners string[]
- executable
Users string[] - filters
Get
Ami Ids Filter[] - name
Regex string - sort
Ascending boolean
- id str
The provider-assigned unique ID for this managed resource.
- ids List[str]
- owners List[str]
- executable_
users List[str] - filters
List[Get
Ami Ids Filter] - name_
regex str - sort_
ascending bool
Supporting Types
GetAmiIdsFilter
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.