As Amazon Web Services part of my daily tasks I’ve decided to choose few useful tools and commands that might help you in some way.

Considerations:

  • Please, before install any of these tools I do recommend to read all descriptions and if you didn’t agree with any don’t use it.
  • I’m not the owner of these tools so if you find any issues that could affect your environment remember the first bullet point “if you don’t agree with any don’t use it.

Follow the list of tools that I use for my daily operations.

Commands for interacting with AWS resources:
http://cryoem-tools.cloud/aws-commands/#awsls

AWLESS
I use this tool for queries. I like the way and simplicity that AWLESS show the content and this tool is very good to check and grab information from AWS. I don’t like the name and I just changed to AW (easy typing). So all examples for AWLESS the command line will be AW.

The AWLESS can be found in https://github.com/wallix/awless/releases

A smart thing of this tools is that you don’t need to type everything. Instead type true for the encrypted value you can just type t.

Examples:

List all encrypted volumes
aw list volumes –filter encrypted=t

List instances filtered by name:
aw list instances –filter name=”xxx”

List all available AMIs
aw list images –filter=a

List snapshots with custom columns, filtered encrypted, description and ordered by date
aw list snapshots –columns id,volume,encrypted,owner,state,progress,created,size,
description –filter ENCRYPTED=t –filter=description=xxx –sort created

AMICleaner
A quick way to deregister your AMI and all associated snapshots.
https://github.com/bonclay7/aws-amicleaner

Remove a list of AMIs and their associate snapshots:
amicleaner –from-ids ami-xxx ami-xxx ami-xxx

S3 Browser
This is a free tool and very useful to quickly create your buckets, manage version, lifecycle and all other options that S3 offer.

The S3 Browser can be found here https://s3browser.com

Recommendations regarding the S3 Browser

  • Before start set a master password so each time that anyone open the tool it will prompt a password. This is an additional security.
  • The disadvantage of the free version is the limit imposed download and update. If you need to transfer large files don’t use this option. Use the aws cli interface instead.

SQL*Plus
I’ve few scripts via SQL*Plus together with the host command to grab information via AWS CLI and it’s handy specially for commands that you need the pass parameter all the time.

So it’s up to you to build your own scripts as needed.

AWS CLI
No need introduction for the standard Amazon Web Services tool.

Below some examples:

EC2
Instances

Get instance information
aws ec2 get-console-output –instance-id i-xxx

Describe instances
aws ec2 describe-instances –output text

Volumes & Snapshots

Create 50GB GP2 volume
aws ec2 create-volume –availability-zone=eu-west-1a –size=50 –volume-type=gp2

Create 100GB volume from snapshot
aws ec2 create-volume –availability-zone us-east-2a –size 100 –snapshot snap-xxx

Detach volume
aws ec2 detach-volume –volume-id vol-xxx

Attach Volume
aws ec2 attach-volume –volume-id vol-xxx –instance i-xxx –device /dev/sde

Count the amount of encrypted volumes
aws ec2 describe-volumes –region us-east-2 –filters Name=encrypted,Values=true Name=attachment.status,Values=attached –query “length(Volumes[])”

Changing the volume from GP2 to IOPS
aws ec2 modify-volume –region us-east-2 –volume-id vol-xxx –volume-type io1 –iops 1000

Changing the volume online and IOPS number
aws ec2 modify-volume –region us-east-2 –volume-id vol-xxx –size 100 –volume-type io1 –iops 10000

Increase and resize the volume online
aws ec2 modify-volume –region us-east-2 –volume-id vol-xxx –size 200 –volume-type gp2
lsblk
sudo resize2fs <dev_path>

List all encrypted volumes
aws ec2 describe-volumes –region us-east-2 –filters Name=encrypted,Values=true Name=attachment.status,Values=attached –output text

Delete a snaphot
aws ec2 delete-snapshot –snapshot-id snap-xxx

AMI

Create AMI
aws ec2 create-image –instance-id i-xxx –name “xxx”

Deregister AMI
aws ec2 deregister-image –image-id ami-xxx

Describe AMI-IDs and description
aws ec2 describe-images –owners xxx –query ‘Images[*].{ID:ImageId,Name:Name}’

Describe 2 days old AMI
aws ec2 describe-images –owners xxx –query ‘Images[*].{date:CreationDate,ID:ImageId}’ | awk ‘{print $4″ | “$2}’ | sort

Import image
aws ec2 import-image –cli-input-json “{  \”Description\”: \”My Image\”, \”DiskContainers\”: [ { \”Description\”: \”First CLI task\”, \”UserBucket\”: { \”S3Bucket\”: \”My Image\”, \”S3Key\” : \”Image.ova\” } } ]}”

S3

Get bucket encryption information
aws s3api get-bucket-encryption –bucket xxx –output text

Copy files from S3 to local your machine
aws s3 cp s3://bucket /path

Copy files from local your machine to S3
aws s3 cp ./  s3://bucket/ –recursive

Exclude all content from a bucket
aws s3 rm s3://bucket –recursive

Sync files between two buckets in different region
aws s3 sync s3://us-west-2-bucket s3://us-east-1-bucket –source-region us-west-2 –region us-east-1

Sync local files with a bucket
aws s3 sync /local_path s3://bucket

Other tools for building, automation and managing Cloud infrastructure.

TntDrive
http://tntdrive.com

TntDrive is used to mount your Amazon S3 Bucket as a Network drive under Windows. There is no freeware of this tool but you can download the free trial version.

Vagrant
https://www.vagrantup.com
Designed to be easiest and fastest way to create virtual environments

Packer
https://www.packer.io
Used for fast infrastructure deployment that allow you to deploy a completely configured and customized machine providing the ability to install and configure your software as the time the image is built.

Terraform
https://www.terraform.io
Designed to automate, versioning and manage your environment using infrastructure as code.

Learning place
www.udemy.com
www.lynda.com

AWS Tech Podcast
https://aws.amazon.com/podcasts/aws-podcast

Hope it helps.

Regards,

Leonardo Bissoli.

leonardo.bissoli

View all posts

Latest videos