How To Use AWS CLI
Automation In AWS
We can categorize automation in DevOps like you use any service that is used to automate things what is AWS CLI?
first lets look at the use of AWS. How you can use AWS?
1) Web UI:- It's very simple you will be able to see all the features and you can do whatever you want to Like launch 2-3 instances together .
2) Automation:- We can write customized code in order to do things like using python (SDK) software development kit.
3) AWS CLI:- We launch the instance using command or we do everything we can do on web UI through code. First lets See how we can launch instance using GUI then we will se how can we do it using Command Line 1) Select the AMI that we want to launch
2) Select the Type of instance.
3) Select the Number of instance , subnet and network.
5) Select security group
6)Select key name and launch the instance.
Let's Start with a very basic example of how to launch the AWS instance using our own customized command. First you need to install the AWS CLI and you need to configure it. As i am the root user I am making one IAM (identity power management) and creating a IAM user and we will Launch the instance using that credentials.
Install AWS cli
pip install awscli
login by the credentials of IAM created above
So what our required goal is to launch AWS instance using Command line. For that we required to collect all the information required for launching the instance.
AMI name = amazon Linux instance type = 12.micro count = 1 subnet = subnet-88... Storage root = 8gb Security group = sg-..... Key Name = Sample
Now We need to make the customized what all the things each one represent. You can use command like help forward with the thing that you required.
So you can search man pages and make your command So here is the command which can be used to launch the instance.
aws ec2 run-instances --image-id ami-oe306 --instance-type t2.micro --count 1 --subnet-id subnet-884872.. --security-group-ids sg-02fb --key-name sample
So now you are ready with your own command to launch the instance now without using the GUI