AWS CLI | Shell script to Query EBS Volumes

Опубликовано: 11 Август 2017
на канале: Yogesh Mehta
5,284
like

This bash script is written to perform the following tasks by communicating with AWS API gateway

Lists volumes id's attached to an EC2 instance.
Provide attributes of an EBS volumes attached to an EC2 instance.
Provide the current status of EBS volumes attached to an EC2 instance.

This script will perform the following checks as part of execution
Checks if AWS CLI is installed or jot.. If not, the script will exit.
Prompt user for the Instance ID’s. User can enter one or multiple Instance Ids.
Script checks for the Valid Instance ID’s. If incorrect Instance ID, the script will exit.

Pre-Requesties
Linux Host with Bash Shell.
AWS CLI and BOTO Installed.
AWS CLI configured (AWS Access ID/Key/Region)

How to use the script ?
cd /script/dir
chmod u+x awsvolstat.sh
./awsvolstat.sh

Usage: ./awsvolstat.sh [ --volume-list|--volume-attributes|--volume-status ]

Valid Options are :
--volume-list lists volumes id's attached to an EC2 instance.
--volume-attributes provides attributes of an EBS volumes attached to an EC2 instance.
--volume-status provides the current status of EBS volumes attached to an EC2 instance.

Script Link : https://lookaside.fbsbx.com/file/awsv...