Giter Club home page Giter Club logo

aws-ec2-ebs-snapshot-check-bash's Introduction

aws-ec2-ebs-snapshot-check-bash

####Amazon Web Services EBS Snapshot Verification - Bash Script

Written by [Casey Labs Inc.] (http://www.caseylabs.com) and [Bleeding Edge Solutions] (http://www.bledsol.net) Contact us for all your Amazon Web Services Consulting needs!

===================================

How it works: check-snapshots.sh will:

  • Gather a list of all running EC2 instances, and of all EBS volumes attached to those instances.
  • Check the snapshots times associated with each in-use EBS volume, and alert if there are no recent snapshots.

Pull requests greatly welcomed!

===================================

REQUIREMENTS

IAM User: This script requires that a new user (e.g. ebs-snapshot) be created in the IAM section of AWS.
Here is a sample IAM policy for AWS permissions that this new user will require:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "Stmt1426256275000",
            "Effect": "Allow",
            "Action": [
                "ec2:DescribeInstances",
                "ec2:DescribeSnapshots",
                "ec2:DescribeVolumes"
            ],
            "Resource": [
                "*"
            ]
        }
    ]
}

AWS CLI: This script requires the AWS CLI tools to be installed.

Linux install instructions for AWS CLI:

  • Make sure Python pip is installed (e.g. yum install python-pip, or apt-get install python-pip)
  • Then run:
pip install awscli

Once the AWS CLI has been installed, you'll need to configure it with the credentials of the IAM user created above: (Note: this step can be skipped if you have an IAM Role setup for your instance to use the IAM policy listed above.)

sudo aws configure

Access Key & Secret Access Key: enter in the credentials generated above for the new IAM user.

Region Name: the region that this instance is currently in: i.e. us-east-1, eu-west-1, etc.

Output Format: enter "text"

Then copy this Bash script to /opt/aws/ebs-snapshot.sh and make it executable:

chmod +x /opt/aws/check-snapshots.sh

To manually test the script:

sudo /opt/aws/check-snapshots.sh

aws-ec2-ebs-snapshot-check-bash's People

Contributors

caseylabs avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.