Introducing AWS CLI to CentOS 7

Introduction

I wanted to create an AWS environment only from the AWS CLI, I set up CentOS7 and installed AWS CLI.

What is 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.

Advance preparation

-Disable SELinux -Disable Firewalld ・ Grant sudo authority to general users ・ Package update ・ OS restart

Introducing the AWS CLI

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.

Set permissions to create resources with the AWS CLI

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 = *****************

Finally

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

Introducing AWS CLI to CentOS 7
[CentOS7] Install aws cli
Introducing JITSI MEET to CentOS 8
Introducing Pacemaker from CentOS 7 repository to RHEL7
[CentOS7] Install aws cli regardless of python version
Introducing CircleCI to Rails
Introducing Bootstrap to Rails 5
Introducing Bootstrap to Rails !!
[AWS] How to check logs
AWS CLI install in Ubuntu 20.04
Moving from AWS to PaizaCloud
Introducing past nvidia-driver to Ubuntu
Connect CentOS 7 to L2TP VPN
Introducing Let's Encrypt on CentOS 7
How to deploy Laravel on CentOS 7
Introducing full calendar to Rails application
To beginners launching Docker on AWS
Run the AWS CLI on Docker
Upgrade from MYSQL5.7 to 8.0 on CentOS 6.7
How to install MariaDB 10.4 on CentOS 8
Introducing Java tips GreenMail to Junit5
Steps to install MySQL 8 on CentOS 8
My note: Introducing Java to Ubuntu
Deploy SpringBoot application to AWS EC2
Steps to install devtoolset-6 on CentOS 7
Introducing React to Rails with react-rails
[AWS CLI] Switch roles to get a Docker image in another account