You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the ec2_instance module, the examples and the table of parameters do not show the region parameter as being required. However, when running the module, the below error occurs:
"msg": "The amazon.aws.ec2_instance module requires a region and none was found in configuration, environment variables or module parameters",
When a region is added, it seems to work fine.
The same is present in the ec2_instance_info module.
Thanks for taking the time to submit this issue. While this may seem like an obvious "it is required", unfortunately it's not that simple. The practical need to set the parameter depends on the configuration of your local environment. Specifically, there are a number of alternative mechanisms for setting the region (as well as the AWS credentials), which we respect:
The "endpoint_url" parameter (mostly used by folks talking to an AWS-like service, but can be used to set the region)
The "AWS_REGION" environment variable
The local AWS configuration files (Typically in ~/.aws/)
Setting the region parameter is highly recommended, since you generally want to place your resources in a specific region (rather than assuming your AWS configs will stay unchanged), but as a parameter it's not strictly required.
There's a note at the end of the parameter documentation which attempts to explain this:
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.
Summary
When using the ec2_instance module, the examples and the table of parameters do not show the region parameter as being required. However, when running the module, the below error occurs:
"msg": "The amazon.aws.ec2_instance module requires a region and none was found in configuration, environment variables or module parameters",
When a region is added, it seems to work fine.
The same is present in the ec2_instance_info module.
Issue Type
Documentation Report
Component Name
ec2_instance, ec2_instance_info
Ansible Version
Collection Versions
Configuration
$ ansible-config dump --only-changed
OS / Environment
RHEL 9 Ansible Automation Platform
Additional Information
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: