aws_account_attribute – Look up AWS account attributes

New in version 2.5.

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 master node that executes this lookup.

  • boto3
  • botocore

Parameters

Parameter Choices/Defaults Configuration Comments
attribute
-
    Choices:
  • supported-platforms
  • default-vpc
  • max-instances
  • vpc-max-security-groups-per-interface
  • max-elastic-ips
  • vpc-max-elastic-ips
  • has-ec2-classic
The attribute for which to get the value(s).
aws_access_key
string
env:EC2_ACCESS_KEY
env:AWS_ACCESS_KEY
env:AWS_ACCESS_KEY_ID
The AWS access key to use.

aliases: aws_access_key_id
aws_profile
string
env:AWS_DEFAULT_PROFILE
env:AWS_PROFILE
The AWS profile

aliases: boto_profile
aws_secret_key
string
env:EC2_SECRET_KEY
env:AWS_SECRET_KEY
env:AWS_SECRET_ACCESS_KEY
The AWS secret key that corresponds to the access key.

aliases: aws_secret_access_key
aws_security_token
string
env:EC2_SECURITY_TOKEN
env:AWS_SESSION_TOKEN
env:AWS_SECURITY_TOKEN
The AWS security token if using temporary access and secret keys.
region
string
env:EC2_REGION
env:AWS_REGION
The region for which to create the connection.

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 Values

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

Key Returned Description
_raw
-
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).



Status

Authors

Hint

If you notice any issues in this documentation, you can edit this document to improve it.

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.