🎗 AWS CLI 🎗
Hello guys !! 🙋🏻♀️🙋🏻♀️
✍🏻 In this task, we have to
🔅 Create a key pair
🔅 Create a security group
🔅 Launch an instance using the above created key pair and security group.
🔅 Create an EBS volume of 1 GB.
🔅 The final step is to attach the above created EBS volume to the instance you created in the previous steps.
So let’s begin…..🤩
👉🏻 First we have to create an IAM User……
So AWS Services has IAM service where we can create user and can give access to that user according to our wish..
♦️ Step 1:
To give user name and here in AWS Access type give programmatic access so that it enables access key & secret key for AWS CLI.
♦️ Step 2 :
Here, give permissions to that user & here I gave Power Access to the user
♦️ Step 3: You can add tags (it’s not mandatory)
♦️ Step 4 : Now AWS, will generate Access Key & Secret Key for that user. We have to use this Access Key & Secret Key to login into our AWS CLI.
👉🏻 Here you can see user “awscli” is created.🤩
🎗 Now in Windows Command Prompt, there’s a command “aws configure” to login with awscli user created above..
🧩 Command syntax is :
aws <command> <subcommand> <options>
🎗 Now, firstly we have to create our own key pair for that we take help of AWS so here to take help we write :
🧩 aws ec2 help :
This gives all the commands available in ec2.
🔰 Now, here to create new key pair you can see subcommand :
🎗 Now, we can create new key pair by command :
🧩 aws ec2 create-key-pair — key-name TaskKeyPair
👉🏻 Now, we have to create our own security group for that we have to search for available commands
🎗 Now, we can create new security group by command :
🧩 aws ec2 create-security-group — group-name TaskSG — description “Task Security Group”
🔰 By using this newly created key pair & security group we have to launch new instance.
🎗 Command is :
🧩 aws run-instances — image-id ami-0e306788ff2473ccb — instance-type t2.micro — subnet-id subnet-37666f5f — count 1 — security-group-ids sg-082e7e59275801fcd — key-name TaskKeyPair
New instance launched…… 🤩🤩
👍🏻 You can see instance is launched in CLI OR GUI…😁
🔰 Now, we have to create an EBS volume of 1 GB.
👉🏻 For that we see the available commands for creating volume:
So, we can now create own volume of 1 GB.
🎗 Command is :
🧩 aws ec2 create-volume — volume-type gp2 — size 1 — availability-zone ap-south-1a
👍🏻We can also see this on AWS Management Console..😁
🔰 Now, finally we have attach the Volume to the instance that we created now…For that we have to check the available commands for attaching volumes.
🎗 Now, we can attach the volume by following command :
🧩 aws ec2 attach-volume — volume-id vol-0522f336c28172eb1 — instance-id i-07345102940d94e27 — device /dev/sdf
♦️Device name can be “sdf or svdh”♦️
👉🏻You can see this in AWS Management Console😁
You can see Volume of 1 GB is in use.😄😄
🎗 Now, we can stop the instance by command :
🧩 aws ec2 stop-instances — instance-id i-07345102940d94e27
You can see through AWS Management Console😁😁