How to backup EC2 instance

Hi, I have an EC2 instance (Bitnami Ubuntu ) running on AWS. I would like to backup the whole instance. what should I do? thanks
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Zephyr ICTCloud ArchitectCommented:
First check if you have an EBS backed volume, if you have, you can take snapshots of your instance.

Now snapshots are like incremental backups so you can take as many or as little as you want and keep your backups fresh, you can also use these snapshots to create an image, so you could always start another instance from that image (or extra instances).

These snapshots can be taken manually via the aws console or automated using  the AWS Command Line Tools or through the AWS API. Using the AWS Command Line Tools you can automate the snapshot process using chron or the Windows equivalent, so that snapshots (backups) are taken automatically. You could also backup the snapshots to an S3 volume on Amazon for example.

Also, if you have extra volumes, containing databases for example, don't forget to include snapshots for those as well...

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Shalom CarmelCTOCommented:
This is a script I am using for a server to backup itself. The script uses the EC2 CLI and the instance metadata, and is run weekly via crond.
It runs on the Amazon Linux, so you may have to adjust the tools locations.


export AWS_ACCESS_KEY=your-access-key
export AWS_SECRET_KEY=your-secret-key

export PATH=$PATH:/opt/aws/bin
export JAVA_HOME=/usr/lib/jvm/jre
export EC2_HOME=/opt/aws/apitools/ec2

DATE=`date +%Y-%m-%d`
TIME=`date +'%R:%S'`

# REGION  eu-west-1
# REGION  sa-east-1
# REGION  us-east-1
# REGION  ap-northeast-1
# REGION  us-west-2
# REGION  us-west-1
# REGION  ap-southeast-1
# REGION  ap-southeast-2

# find availability zone, for example eu-west-1b

# remove last letter to get region
# set EC2_URL environment variable. We ignore it by using the --region switch directly
# export EC2_URL=ec2.$

# find this instance id

# find this volume. only works for single volume servers.
ec2string=`ec2-describe-instance-attribute  --region $EC2_REGION  $EC2_INSTANCE_ID -b`

# send backup and get snapshot id
echo ec2-create-snapshot  --region $EC2_REGION  $EC2_VOLUME -d "Weekly backup $DATE.$TIME"

ec2string=`ec2-create-snapshot  --region $EC2_REGION  $EC2_VOLUME -d "Weekly backup $DATE.$TIME"`

# get Name attribute
echo ec2-describe-tags --region $EC2_REGION --filter "resource-id=$EC2_INSTANCE_ID" --filter "key=Name"

ec2string=`ec2-describe-tags --region $EC2_REGION --filter resource-id=$EC2_INSTANCE_ID --filter key=Name`

# create Name tag for snapshot
echo ec2-create-tags  --region $EC2_REGION  $EC2_SNAPSHOT --tag "Name=$EC2_INSTANCE_NAME"
ec2-create-tags  --region $EC2_REGION  $EC2_SNAPSHOT --tag "Name=$EC2_INSTANCE_NAME"

Open in new window

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.