AWS EC2 EBS Automatic Snapshot BASH


How it works: will:

  • Determine the instance ID of the EC2 server on which the script runs
  • Transferring the data via rsync to EBS volume which we attached.
  • Create snapshot of volume which we mentioned the script.
  • The script will then delete all associated snapshots taken by the script that are older than 7 days


  • IAM User
  • Create EBS volume and attach to EC2 instance which we want to take data backup and mount.
  • Script: Create file and copy snapshot script, then Change the below lines as per need and make it executable. In order to schedule a backup we can setup a cron job.
  • Change the lines rsync -av –stats –delete –numeric-ids /EC2 data folder /EBS volume mount point and volume_list=”EBS ID” as per your need and configuration.
  • Script


    export PATH=$PATH:/usr/local/bin/:/usr/bin

    # Safety feature: exit script if error is returned, or if variables not…

    View original post 480 more words


    Leave a Reply

    Fill in your details below or click an icon to log in: Logo

    You are commenting using your account. Log Out /  Change )

    Google+ photo

    You are commenting using your Google+ account. Log Out /  Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out /  Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out /  Change )

    Connecting to %s