amazon.aws.aws_account_attribute lookup – Look up AWS account attributes

Note

This lookup plugin is part of the amazon.aws collection (version 5.5.1).

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 lookup plugin, see Requirements for details.

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

Synopsis

  • Describes attributes of your AWS account. You can specify one of the listed attribute choices or omit it to see all attributes.

Requirements

The below requirements are needed on the local controller node that executes this lookup.

  • python >= 3.6

  • boto3 >= 1.18.0

  • botocore >= 1.21.0

Parameters

Parameter

Comments

attribute

string

The attribute for which to get the value(s).

Choices:

  • "supported-platforms"

  • "default-vpc"

  • "max-instances"

  • "vpc-max-security-groups-per-interface"

  • "max-elastic-ips"

  • "vpc-max-elastic-ips"

  • "has-ec2-classic"

aws_access_key

aliases: aws_access_key_id

string

The AWS access key to use.

Configuration:

  • Environment variable: EC2_ACCESS_KEY

  • Environment variable: AWS_ACCESS_KEY

  • Environment variable: AWS_ACCESS_KEY_ID

aws_profile

aliases: boto_profile

string

The AWS profile

Configuration:

  • Environment variable: AWS_DEFAULT_PROFILE

  • Environment variable: AWS_PROFILE

aws_secret_key

aliases: aws_secret_access_key

string

The AWS secret key that corresponds to the access key.

Configuration:

  • Environment variable: EC2_SECRET_KEY

  • Environment variable: AWS_SECRET_KEY

  • Environment variable: AWS_SECRET_ACCESS_KEY

aws_security_token

string

The AWS security token if using temporary access and secret keys.

Configuration:

  • Environment variable: EC2_SECURITY_TOKEN

  • Environment variable: AWS_SESSION_TOKEN

  • Environment variable: AWS_SECURITY_TOKEN

region

string

The region for which to create the connection.

Configuration:

  • Environment variable: EC2_REGION

  • Environment variable: AWS_REGION

Examples

vars:
  has_ec2_classic: "{{ lookup('aws_account_attribute', attribute='has-ec2-classic') }}"
  # true | false

  default_vpc_id: "{{ lookup('aws_account_attribute', attribute='default-vpc') }}"
  # vpc-xxxxxxxx | none

  account_details: "{{ lookup('aws_account_attribute', wantlist='true') }}"
  # {'default-vpc': ['vpc-xxxxxxxx'], 'max-elastic-ips': ['5'], 'max-instances': ['20'],
  #  'supported-platforms': ['VPC', 'EC2'], 'vpc-max-elastic-ips': ['5'], 'vpc-max-security-groups-per-interface': ['5']}

Return Value

Key

Description

Return value

string

Returns a boolean when attribute is check_ec2_classic. Otherwise returns the value(s) of the attribute (or all attributes if one is not specified).

Returned: success

Authors

  • Sloane Hertel (@s-hertel)

Hint

Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.