amazon.aws.ec2_instance_type_info module – Retrieve information about EC2 instance types

Note

This module is part of the amazon.aws collection (version 11.3.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install amazon.aws. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: amazon.aws.ec2_instance_type_info.

New in amazon.aws 11.1.0

Synopsis

  • Retrieves detailed information about EC2 instance types.

  • By default, all instance types for the current region are described.

  • Can filter results using instance type names or filters.

  • Does not implement DryRun feature.

Requirements

The below requirements are needed on the host that executes this module.

  • python >= 3.6

  • boto3 >= 1.35.0

  • botocore >= 1.35.0

Parameters

Parameter

Comments

access_key

aliases: aws_access_key_id, aws_access_key

string

AWS access key ID.

See the AWS documentation for more information about access tokens https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys.

The AWS_ACCESS_KEY_ID or AWS_ACCESS_KEY environment variables may also be used in decreasing order of preference.

The aws_access_key and profile options are mutually exclusive.

The aws_access_key_id alias was added in release 5.1.0 for consistency with the AWS botocore SDK.

aws_ca_bundle

path

The location of a CA Bundle to use when validating SSL certificates.

The AWS_CA_BUNDLE environment variable may also be used.

aws_config

dictionary

A dictionary to modify the botocore configuration.

Parameters can be found in the AWS documentation https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config.

debug_botocore_endpoint_logs

boolean

Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource_actions key in the task results. Use the aws_resource_action callback to output to total list made during a playbook.

The ANSIBLE_DEBUG_BOTOCORE_LOGS environment variable may also be used.

Choices:

  • false ← (default)

  • true

endpoint_url

aliases: aws_endpoint_url

string

URL to connect to instead of the default AWS endpoints. While this can be used to connection to other AWS-compatible services the amazon.aws and community.aws collections are only tested against AWS.

The AWS_URL environment variable may also be used.

filters

dictionary

A dict of filters to apply. Each dict item consists of a filter key and a filter value.

See https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeInstanceTypes.html for possible filters.

Filter names and values are case sensitive.

Filter values support wildcards (e.g., t3.* to match all t3 instance types).

Default: {}

instance_types

list / elements=string

List of instance types to describe.

Must be exact instance type names (e.g., t3.micro, m5.large).

For wildcard matching, use the filters option with instance-type filter instead.

Maximum of 100 instance types.

If not provided, all instance types are returned.

Default: []

profile

aliases: aws_profile

string

A named AWS profile to use for authentication.

See the AWS documentation for more information about named profiles https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html.

The AWS_PROFILE environment variable may also be used.

The profile option is mutually exclusive with the aws_access_key, aws_secret_key and session_token options.

region

aliases: aws_region

string

The AWS region to use.

For global services such as IAM, Route53 and CloudFront, region is ignored.

The AWS_REGION environment variable may also be used.

See the Amazon AWS documentation for more information http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region.

secret_key

aliases: aws_secret_access_key, aws_secret_key

string

AWS secret access key.

See the AWS documentation for more information about access tokens https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys.

The AWS_SECRET_ACCESS_KEY or AWS_SECRET_KEY environment variables may also be used in decreasing order of preference.

The secret_key and profile options are mutually exclusive.

The aws_secret_access_key alias was added in release 5.1.0 for consistency with the AWS botocore SDK.

session_token

aliases: aws_session_token

string

AWS STS session token for use with temporary credentials.

See the AWS documentation for more information about access tokens https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys.

The AWS_SESSION_TOKEN environment variable may also be used.

The session_token and profile options are mutually exclusive.

validate_certs

boolean

When set to false, SSL certificates will not be validated for communication with the AWS APIs.

Setting validate_certs=false is strongly discouraged, as an alternative, consider setting aws_ca_bundle instead.

Choices:

  • false

  • true ← (default)

Notes

Note

  • Caution: For modules, environment variables and configuration files are read from the Ansible ‘host’ context and not the ‘controller’ context. As such, files may need to be explicitly copied to the ‘host’. For lookup and connection plugins, environment variables and configuration files are read from the Ansible ‘controller’ context and not the ‘host’ context.

  • The AWS SDK (boto3) that Ansible uses may also read defaults for credentials and other settings, such as the region, from its configuration files in the Ansible ‘host’ context (typically ~/.aws/credentials). See https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html for more information.

Examples

- name: Get information about all instance types
  amazon.aws.ec2_instance_type_info:
  register: all_instance_types

- name: Get information about specific instance types
  ec2_instance_type_info:
    instance_types:
      - t3.micro
      - t3.small
      - t3.medium
  register: t3_types

- name: Get all c5 instance types using wildcard filter
  amazon.aws.ec2_instance_type_info:
    filters:
      instance-type:
        - "c5.*"
  register: c5_types

- name: Filter for current generation instance types with GPU
  amazon.aws.ec2_instance_type_info:
    filters:
      current-generation:
        - "true"
      instance-type:
        - "p3.*"
  register: gpu_types

- name: Filter for bare metal instance types
  amazon.aws.ec2_instance_type_info:
    filters:
      bare-metal:
        - "true"
  register: bare_metal_types

- name: Filter by processor architecture
  amazon.aws.ec2_instance_type_info:
    filters:
      processor-info.supported-architecture:
        - arm64
  register: arm_types

- name: Filter for free tier eligible instances
  amazon.aws.ec2_instance_type_info:
    filters:
      free-tier-eligible:
        - "true"
  register: free_tier_types

- name: Combine multiple filters (m5 family with 4 vCPUs)
  amazon.aws.ec2_instance_type_info:
    filters:
      instance-type:
        - "m5.*"
      vcpu-info.default-vcpus:
        - "4"
  register: m5_4vcpu_types

- name: Filter with multiple values
  amazon.aws.ec2_instance_type_info:
    filters:
      processor-info.supported-architecture:
        - arm64
        - x86_64
  register: multi_arch_types

- name: Combine specific instance types with filters
  amazon.aws.ec2_instance_type_info:
    instance_types:
      - t3.micro
      - t3.small
      - t3.medium
    filters:
      processor-info.supported-architecture:
        - x86_64
  register: filtered_t3_types

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

instance_types

complex

List of instance type information objects.

Returned: always

auto_recovery_supported

boolean

Whether auto recovery is supported.

Returned: always

bare_metal

boolean

Whether this is a bare metal instance type.

Returned: always

burstable_performance_supported

boolean

Whether burstable performance is supported.

Returned: always

current_generation

boolean

Whether the instance type is current generation.

Returned: always

dedicated_hosts_supported

boolean

Whether dedicated hosts are supported.

Returned: always

ebs_info

dictionary

EBS information.

Returned: always

ebs_optimized_info

dictionary

EBS optimized performance info.

Returned: success

ebs_optimized_support

string

EBS optimized support status.

Returned: success

encryption_support

string

EBS encryption support status.

Returned: success

nvme_support

string

NVMe support status.

Returned: success

fpga_info

dictionary

FPGA information.

Returned: when FPGA is available

free_tier_eligible

boolean

Whether the instance type is eligible for the free tier.

Returned: always

gpu_info

dictionary

GPU information.

Returned: when GPU is available

gpus

list / elements=dictionary

List of GPU devices.

Returned: success

total_gpu_memory_in_mi_b

integer

Total GPU memory in MiB.

Returned: success

hibernation_supported

boolean

Whether hibernation is supported.

Returned: always

hypervisor

string

The hypervisor type (nitro, xen).

Returned: when available

inference_accelerator_info

dictionary

Inference accelerator information.

Returned: when inference accelerators are available

instance_storage_info

dictionary

Instance storage information.

Returned: when instance_storage_supported is true

disks

list / elements=dictionary

List of instance storage disks.

Returned: success

encryption_support

string

Encryption support status.

Returned: success

nvme_support

string

NVMe support status.

Returned: success

total_size_in_g_b

integer

Total instance storage size in GB.

Returned: success

instance_storage_supported

boolean

Whether instance storage is supported.

Returned: always

instance_type

string

The instance type identifier.

Returned: always

Sample: "t3.micro"

memory_info

dictionary

Memory information.

Returned: always

size_in_mi_b

integer

Memory size in MiB.

Returned: success

network_info

dictionary

Network information.

Returned: always

efa_supported

boolean

Whether EFA is supported.

Returned: success

ena_support

string

ENA support status.

Returned: success

encryption_in_transit_supported

boolean

Whether encryption in transit is supported.

Returned: success

ipv4_addresses_per_interface

integer

Maximum IPv4 addresses per interface.

Returned: success

ipv6_addresses_per_interface

integer

Maximum IPv6 addresses per interface.

Returned: success

ipv6_supported

boolean

Whether IPv6 is supported.

Returned: success

maximum_network_cards

integer

Maximum number of network cards.

Returned: success

maximum_network_interfaces

integer

Maximum number of network interfaces.

Returned: success

network_performance

string

Network performance description.

Returned: success

nitro_enclaves_support

string

Nitro Enclaves support status.

Returned: when available

nitro_tpm_info

dictionary

NitroTPM information.

Returned: when NitroTPM is supported

nitro_tpm_support

string

NitroTPM support status.

Returned: when available

placement_group_info

dictionary

Placement group information.

Returned: always

supported_strategies

list / elements=string

Supported placement strategies.

Returned: success

processor_info

dictionary

Processor information.

Returned: always

supported_architectures

list / elements=string

Supported CPU architectures.

Returned: success

sustained_clock_speed_in_ghz

float

Sustained clock speed in GHz.

Returned: success

supported_boot_modes

list / elements=string

Supported boot modes (legacy-bios, uefi).

Returned: always

supported_root_device_types

list / elements=string

Supported root device types (ebs, instance-store).

Returned: always

supported_usage_classes

list / elements=string

Usage classes supported (on-demand, spot, capacity-block).

Returned: always

supported_virtualization_types

list / elements=string

Supported virtualization types (hvm, paravirtual).

Returned: always

v_cpu_info

dictionary

vCPU information.

Returned: always

default_cores

integer

Default number of cores.

Returned: success

default_threads_per_core

integer

Default threads per core.

Returned: success

default_v_cpus

integer

Default number of vCPUs.

Returned: success

valid_cores

list / elements=integer

List of valid core counts.

Returned: success

valid_threads_per_core

list / elements=integer

List of valid thread per core counts.

Returned: success

Authors

  • Jonathan Springer (@jonpspri)