1. Packages
  2. AWS Classic
  3. API Docs
  4. ec2
  5. getInstanceTypes

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.32.0 published on Friday, Apr 19, 2024 by Pulumi

aws.ec2.getInstanceTypes

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.32.0 published on Friday, Apr 19, 2024 by Pulumi

    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=[
        aws.ec2.GetInstanceTypesFilterArgs(
            name="auto-recovery-supported",
            values=["true"],
        ),
        aws.ec2.GetInstanceTypesFilterArgs(
            name="network-info.encryption-in-transit-supported",
            values=["true"],
        ),
        aws.ec2.GetInstanceTypesFilterArgs(
            name="instance-storage-supported",
            values=["true"],
        ),
        aws.ec2.GetInstanceTypesFilterArgs(
            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)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: aws:ec2/getInstanceTypes:getInstanceTypes
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Filters List<GetInstanceTypesFilter>
    One or more configuration blocks containing name-values filters. See the EC2 API Reference for supported filters. Detailed below.
    Filters []GetInstanceTypesFilter
    One or more configuration blocks containing name-values filters. See the EC2 API Reference for supported filters. Detailed below.
    filters List<GetInstanceTypesFilter>
    One or more configuration blocks containing name-values filters. See the EC2 API Reference for supported filters. Detailed below.
    filters GetInstanceTypesFilter[]
    One or more configuration blocks containing name-values filters. See the EC2 API Reference for supported filters. Detailed below.
    filters Sequence[GetInstanceTypesFilter]
    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<GetInstanceTypesFilter>
    Id string
    The provider-assigned unique ID for this managed resource.
    InstanceTypes []string
    List of EC2 Instance Types.
    Filters []GetInstanceTypesFilter
    id String
    The provider-assigned unique ID for this managed resource.
    instanceTypes List<String>
    List of EC2 Instance Types.
    filters List<GetInstanceTypesFilter>
    id string
    The provider-assigned unique ID for this managed resource.
    instanceTypes string[]
    List of EC2 Instance Types.
    filters GetInstanceTypesFilter[]
    id str
    The provider-assigned unique ID for this managed resource.
    instance_types Sequence[str]
    List of EC2 Instance Types.
    filters Sequence[GetInstanceTypesFilter]
    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

    Name string
    Name of the filter.
    Values List<string>
    List of one or more values for the filter.
    Name string
    Name of the filter.
    Values []string
    List of one or more values for the filter.
    name String
    Name of the filter.
    values List<String>
    List of one or more values for the filter.
    name string
    Name of the filter.
    values string[]
    List of one or more values for the filter.
    name str
    Name of the filter.
    values Sequence[str]
    List of one or more values for the filter.
    name String
    Name of the filter.
    values List<String>
    List of one or more values for the filter.

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.32.0 published on Friday, Apr 19, 2024 by Pulumi