DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Because the DevOps movement has redefined engineering responsibilities, SREs now have to become stewards of observability strategy.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Related

  • Event Sourcing 101: When to Use and How to Avoid Pitfalls
  • How ARIA Snapshot Testing Solves Common Playwright Issues
  • Mastering Redirects With Cloudflare Bulk Redirects
  • Automatic Snapshots Using Snapshot Manager

Trending

  • Data Lake vs. Warehouse vs. Lakehouse vs. Mart: Choosing the Right Architecture for Your Business
  • AI-Driven Root Cause Analysis in SRE: Enhancing Incident Resolution
  • Building Reliable LLM-Powered Microservices With Kubernetes on AWS
  • Immutable Secrets Management: A Zero-Trust Approach to Sensitive Data in Containers

EBS Report - A Simple Script that Creates a CSV Report on EBS Volumes

By 
Uri Wolloch user avatar
Uri Wolloch
·
Jun. 15, 15 · Code Snippet
Likes (0)
Comment
Save
Tweet
Share
3.5K Views

Join the DZone community and get the full member experience.

Join For Free

 I want to share a little utility we wrote, which is basic, but can be quite useful. If you have a big environment with lots of instances, EBS volumes and EBS snapshots you sometime lose your grip and control. I mean specifically in terms of "Is my data protected?" or "Do I have recent enough snapshots to recover my instances, if needed." Our customers, using Cloud Protection Manager, typically don't need to worry about it, as they have a complete control over their EC2 backup operations. However, many EC2 users may find it useful to get a report that will be able to tell which instances and volumes don't have recent enough snapshots.


This utility, which is a python script, creates a report as a CSV file which gives a list of EBS volumes, with almost all details, including which instance volumes are attached to, and tells how many snapshots there are on each volume, and when the oldest and newest snapshots were taken.

Since it's in CSV format, it's easy to open it with a spreadsheet (like Excel) and then color the lines according to values (click on picture to see). You can make volumes that have too few snapshots or don't have a recent enough one to be colored red, ones with more but stilll not enough can be colored yellow etc... If you go a bit deeper you can even find out which instances have "red" or "yellow" volumes, to be able to identify them as "unprotected."

For each volume the following details are given: region, volume id, volume name, volume type, iops value, size (GiB), snapshot the volume was created from, instance the volume is attached to, device name, whether the volume is encrypted, number of EBS snapshots on this volume, time and id of oldest snapshot, time and id of newest snapshot.

The script is written in Python and will work on Linux or Windows, as long as Python 2.7.3 or newer (not Python 3) is installed, and the “boto” library is installed as well (at least 2.31.1). Instructions to install boto can be found here: http://boto.readthedocs.org/en/latest/getting_started.html#installing-boto
(Or simply download it from https://pypi.python.org/pypi/boto
then open the tarball, go in the installation folder and type: python setup.py install)

The script is well documented. It can get the AWS credentials from command line or set defaults in the script itself. If the script is run from within an instance that has a proper IAM role, then no credentials are needed at all.

ebs-report.py
README.txt

>python ebs-report.py --help
usage: ebs-report.py [-h] [--regions REGIONS] [--access_key ACCESS_KEY]
                     [--secret_key SECRET_KEY] --file FILE

Creates a CSV report about EBS volumes and tracks snapshots on them.

optional arguments:
  -h, --help            show this help message and exit
  --regions REGIONS     AWS regions to create the report on, can add multiple
                        with | as separator. Default will assume all regions
  --access_key ACCESS_KEY
                        AWS API access key. If missing default is used
  --secret_key SECRET_KEY
                        AWS API secret key. If missing default is used
  --file FILE           Path for output CSV file

Example:

python ebs-report.py --regions us-east-1 --access_key AKIAIXXXXXXXXXX3N32Q
                         --secret_key UGSYXXXXXXXXXXXXXXBf0bS/S+OwnA2GrJ0MOY4Y --file d:\my-ebs-report-July-2014.csv


README file - http://www.n2ws.com/images/code/ebs-report/README.txt
CSV Snapshot (computer storage)

Opinions expressed by DZone contributors are their own.

Related

  • Event Sourcing 101: When to Use and How to Avoid Pitfalls
  • How ARIA Snapshot Testing Solves Common Playwright Issues
  • Mastering Redirects With Cloudflare Bulk Redirects
  • Automatic Snapshots Using Snapshot Manager

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!