Is there a way to set an AWS instance's name from command line tools?

You can set the Name of an instance using the command line tools with this command

ec2addtag i-??????? --tag Name=my-fancy-name

Yes, you can use the command line tools to view this information, if you need to parse this information out, you will be better off using the API (as it is both far faster and the information is much easier to work with).

From the command line tools, run: ec2-describe-instances

You will find a line that reads similar to the following:

TAG     instance        i-xxxxxxxx      Name    MyTagName

For a cleaner readout, you might want to pipe the output through grep:

ec2-describe-instances | grep TAG

Don't forget to export (EC2_PRIVATE_KEY, EC2_CERT) or set (-K, -C) the path to your private key and certificate files.


You can use the aws command to set the name of an instance like so:

aws ec2 create-tags --resources i-??????? --tag Key=Name,Value="MY INSTANCE NAME"