memiah.aws-cli
AWS CLI
This is an Ansible Role that installs and sets up the Amazon AWS Command Line Interface tools on RedHat systems.
Requirements
To use this, you need an Amazon AWS account. Make sure you have a user and access key credentials that allow access to the specified bucket.
By default, the setup will work for the root user. If you want to use a different user, that user must already exist on the server.
It's best to create an AWS user with limited permissions for only the actions you need. You can manage permissions using policies. Below is an example policy named AmazonS3CreateReadWriteAccess-[bucket-name]
that allows basic access (create, list, put) to the bucket [bucket-name]
.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [ "s3:CreateBucket", "s3:ListBucket" ],
"Resource": [ "arn:aws:s3:::[bucket-name]" ]
},
{
"Effect": "Allow",
"Action": [ "s3:PutObject" ],
"Resource": [ "arn:aws:s3:::[bucket-name]/*" ]
}
]
}
Role Variables
Here are the available variables with their default values (see defaults/main.yml
):
aws_cli_system_user
: root
This is the system user profile where the AWS settings will be saved.aws_cli_profile
: "default"
This creates a new AWS profile specifically for this script.aws_cli_access_key
: ""
Your Amazon AWS access key.aws_cli_secret_key
: ""
Your Amazon AWS secret key.aws_cli_region
: eu-west-1
The region where the S3 bucket is located.aws_cli_format
: text
The output format from the AWS CLI can bejson
,text
, ortable
.aws_cli_version
: false
You can specify a specific version of the AWS CLI, e.g.,1.19.107
. The default is the latest version.
Dependencies
None.
Example Playbook
- hosts: mysql-servers
become: yes
vars_files:
- vars/main.yml
roles:
- memiah.aws-cli
In the vars/main.yml
file:
aws_cli_access_key: "access_key_here"
aws_cli_secret_key: "secret_key_here"
aws_cli_region: eu-west-1
aws_cli_format: text
License
MIT / BSD
Author Information
This role was created in 2016 by Memiah Limited.
ansible-galaxy install memiah.aws-cli