How to set Name of EC2 instance by aws cli

Today, we are sharing a quick tip on AWS cloud computing. We will learn how to set Name of EC2 instance by aws cli. This task you can also do through AWS console dashboard but as a System Administrator it is good practice to use command line.

At present AWS is top Cloud Computing provider.

Set Name of EC2 instance by aws cli

Requirement : You must have aws-cli installed in your system and AWS keys must be set as well. Read helpful AWS document to install aws-cli in your system .

Name is in other words a tag of EC2 instance. Run the below command to set the Name of EC2 instance.

Replace :
us-east-1 ## Replace with as per region where your EC2 instance is running . List of EC2 Region.
i-xxxxxxxx ## Replace with instance id of your EC2 instance
Web01 ## Replace with the Name tag you want to set for EC2 instance

aws --region us-east-1 ec2 create-tags --resources i-xxxxxxxx --tags "Key=Name,Value=Web01"

Before : The Tag Name was not set to EC2 instance, given below is screenshot.

aws

After : The Tag Name is set to EC2 instance after using the command shared in this post, given below is screenshot.

AWS