I wanted to create an AWS environment only from the AWS CLI, I set up CentOS7 and installed AWS CLI.
The AWS CLI is a tool for operating and managing AWS services from the command line. It can be used on various operating systems such as Linux, Mac, and Windows. I think the biggest advantage of using the AWS CLI is that you can automate the operations that you were doing with the GUI. What it means is that it is executed by a command, so it becomes easier to automate the infrastructure by writing it with a script or the like.
I've been touching the AWS console a lot until now, but recently it's getting harder to get new screens. Sometimes it's a hassle to build a VPC from scratch.
-Disable SELinux -Disable Firewalld ・ Grant sudo authority to general users ・ Package update ・ OS restart
Install the AWS CLI using Python.
# curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
# python get-pip.py
# pip install awscli
# aws --version
aws-cli/1.18.129 Python/2.7.5 Linux/3.10.0-1127.19.1.el7.x86_64 botocore/1.17.52
Yes, this completes the installation.
If you want to run AWS CLI on EC2, you can give EC2 an IAM Role. There is no need to set an access key or secret access key.
This time I'm on my home server, not on AWS If you want to do the same, create an IAM user, assign the required permissions, and then Please execute the access key and secret key on the IAM creation screen.
# aws configure
AWS Access Key ID [None]: *****************
AWS Secret Access Key [None]: *****************
Default region name [None]: ap-northeast-1
Default output format [None]: json
Check if each file can be created. Make sure there is no difference from what you entered in aws configure.
# cat .aws/config
[default]
region = ap-northeast-1
output = json
# cat .aws/credentials
[default]
aws_access_key_id = *****************
aws_secret_access_key = *****************
Based on this, I would like to create around the AWS VPC with just the CLI. Of course, AWS also has CloudFormation, and it is important to be able to build with this, so I would like to make sure that I do not neglect my studies.
Recommended Posts