Translate

Sunday, November 15, 2020

AWS Cli

I often have to work with AWS on some projects and I discovered the AWS Cli tool, that allow to do lot of things on AWS from your machine terminal.

This (and future articles) are just tips and notes about how better work with AWS.

Install AWS Cli - Ubuntu

AWS Cli - MacOS Catalina


Create/Edit configuration

aws --configure is the command to use to create/edit configurations.
It is assumed to have available an Access Key/Password for the account.

  • aws --configure → create/edit default configuration

  • aws --configure --profile <profile_name> → create/edit <profile_name> configuration

Retrieve instance public DNS

Is possible to retrieve the public DNS of an instance via a AWS Cli command.
It is useful to automatic retrieve the access DNS on server restarted in the night.

It is assumed :

  • to have a configuration set up for the AWS account and knowing its name (<profile_name>)

  • to know the instance ID (<instance_id>)

Use this command :

aws ec2 describe-instances --instance-id <instance_id> --query 'Reservations[].Instances[].PublicDnsName' --output text --profile <profile_name>

No comments:

Post a Comment