AWS v6.71.0 published on Friday, Mar 7, 2025 by Pulumi
aws.ec2.getInstanceTypes
Explore with Pulumi AI
Information about EC2 Instance Types.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const test = aws.ec2.getInstanceTypes({
    filters: [
        {
            name: "auto-recovery-supported",
            values: ["true"],
        },
        {
            name: "network-info.encryption-in-transit-supported",
            values: ["true"],
        },
        {
            name: "instance-storage-supported",
            values: ["true"],
        },
        {
            name: "instance-type",
            values: [
                "g5.2xlarge",
                "g5.4xlarge",
            ],
        },
    ],
});
import pulumi
import pulumi_aws as aws
test = aws.ec2.get_instance_types(filters=[
    {
        "name": "auto-recovery-supported",
        "values": ["true"],
    },
    {
        "name": "network-info.encryption-in-transit-supported",
        "values": ["true"],
    },
    {
        "name": "instance-storage-supported",
        "values": ["true"],
    },
    {
        "name": "instance-type",
        "values": [
            "g5.2xlarge",
            "g5.4xlarge",
        ],
    },
])
package main
import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ec2.GetInstanceTypes(ctx, &ec2.GetInstanceTypesArgs{
			Filters: []ec2.GetInstanceTypesFilter{
				{
					Name: "auto-recovery-supported",
					Values: []string{
						"true",
					},
				},
				{
					Name: "network-info.encryption-in-transit-supported",
					Values: []string{
						"true",
					},
				},
				{
					Name: "instance-storage-supported",
					Values: []string{
						"true",
					},
				},
				{
					Name: "instance-type",
					Values: []string{
						"g5.2xlarge",
						"g5.4xlarge",
					},
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() => 
{
    var test = Aws.Ec2.GetInstanceTypes.Invoke(new()
    {
        Filters = new[]
        {
            new Aws.Ec2.Inputs.GetInstanceTypesFilterInputArgs
            {
                Name = "auto-recovery-supported",
                Values = new[]
                {
                    "true",
                },
            },
            new Aws.Ec2.Inputs.GetInstanceTypesFilterInputArgs
            {
                Name = "network-info.encryption-in-transit-supported",
                Values = new[]
                {
                    "true",
                },
            },
            new Aws.Ec2.Inputs.GetInstanceTypesFilterInputArgs
            {
                Name = "instance-storage-supported",
                Values = new[]
                {
                    "true",
                },
            },
            new Aws.Ec2.Inputs.GetInstanceTypesFilterInputArgs
            {
                Name = "instance-type",
                Values = new[]
                {
                    "g5.2xlarge",
                    "g5.4xlarge",
                },
            },
        },
    });
});
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.GetInstanceTypesArgs;
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 test = Ec2Functions.getInstanceTypes(GetInstanceTypesArgs.builder()
            .filters(            
                GetInstanceTypesFilterArgs.builder()
                    .name("auto-recovery-supported")
                    .values("true")
                    .build(),
                GetInstanceTypesFilterArgs.builder()
                    .name("network-info.encryption-in-transit-supported")
                    .values("true")
                    .build(),
                GetInstanceTypesFilterArgs.builder()
                    .name("instance-storage-supported")
                    .values("true")
                    .build(),
                GetInstanceTypesFilterArgs.builder()
                    .name("instance-type")
                    .values(                    
                        "g5.2xlarge",
                        "g5.4xlarge")
                    .build())
            .build());
    }
}
variables:
  test:
    fn::invoke:
      function: aws:ec2:getInstanceTypes
      arguments:
        filters:
          - name: auto-recovery-supported
            values:
              - 'true'
          - name: network-info.encryption-in-transit-supported
            values:
              - 'true'
          - name: instance-storage-supported
            values:
              - 'true'
          - name: instance-type
            values:
              - g5.2xlarge
              - g5.4xlarge
Using getInstanceTypes
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 getInstanceTypes(args: GetInstanceTypesArgs, opts?: InvokeOptions): Promise<GetInstanceTypesResult>
function getInstanceTypesOutput(args: GetInstanceTypesOutputArgs, opts?: InvokeOptions): Output<GetInstanceTypesResult>def get_instance_types(filters: Optional[Sequence[GetInstanceTypesFilter]] = None,
                       opts: Optional[InvokeOptions] = None) -> GetInstanceTypesResult
def get_instance_types_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetInstanceTypesFilterArgs]]]] = None,
                       opts: Optional[InvokeOptions] = None) -> Output[GetInstanceTypesResult]func GetInstanceTypes(ctx *Context, args *GetInstanceTypesArgs, opts ...InvokeOption) (*GetInstanceTypesResult, error)
func GetInstanceTypesOutput(ctx *Context, args *GetInstanceTypesOutputArgs, opts ...InvokeOption) GetInstanceTypesResultOutput> Note: This function is named GetInstanceTypes in the Go SDK.
public static class GetInstanceTypes 
{
    public static Task<GetInstanceTypesResult> InvokeAsync(GetInstanceTypesArgs args, InvokeOptions? opts = null)
    public static Output<GetInstanceTypesResult> Invoke(GetInstanceTypesInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetInstanceTypesResult> getInstanceTypes(GetInstanceTypesArgs args, InvokeOptions options)
public static Output<GetInstanceTypesResult> getInstanceTypes(GetInstanceTypesArgs args, InvokeOptions options)
fn::invoke:
  function: aws:ec2/getInstanceTypes:getInstanceTypes
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Filters
List<GetInstance Types Filter> 
- One or more configuration blocks containing name-values filters. See the EC2 API Reference for supported filters. Detailed below.
- Filters
[]GetInstance Types Filter 
- One or more configuration blocks containing name-values filters. See the EC2 API Reference for supported filters. Detailed below.
- filters
List<GetInstance Types Filter> 
- One or more configuration blocks containing name-values filters. See the EC2 API Reference for supported filters. Detailed below.
- filters
GetInstance Types Filter[] 
- One or more configuration blocks containing name-values filters. See the EC2 API Reference for supported filters. Detailed below.
- filters
Sequence[GetInstance Types Filter] 
- One or more configuration blocks containing name-values filters. See the EC2 API Reference for supported filters. Detailed below.
- filters List<Property Map>
- One or more configuration blocks containing name-values filters. See the EC2 API Reference for supported filters. Detailed below.
getInstanceTypes Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- InstanceTypes List<string>
- List of EC2 Instance Types.
- Filters
List<GetInstance Types Filter> 
- Id string
- The provider-assigned unique ID for this managed resource.
- InstanceTypes []string
- List of EC2 Instance Types.
- Filters
[]GetInstance Types Filter 
- id String
- The provider-assigned unique ID for this managed resource.
- instanceTypes List<String>
- List of EC2 Instance Types.
- filters
List<GetInstance Types Filter> 
- id string
- The provider-assigned unique ID for this managed resource.
- instanceTypes string[]
- List of EC2 Instance Types.
- filters
GetInstance Types Filter[] 
- id str
- The provider-assigned unique ID for this managed resource.
- instance_types Sequence[str]
- List of EC2 Instance Types.
- filters
Sequence[GetInstance Types Filter] 
- id String
- The provider-assigned unique ID for this managed resource.
- instanceTypes List<String>
- List of EC2 Instance Types.
- filters List<Property Map>
Supporting Types
GetInstanceTypesFilter   
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the awsTerraform Provider.