6

I have a website hosted on aws EC2. Do I need backups in case the instance fails or is there enough redundancy on amazon's side already?

1
  • While there is redundency that will copy with some failure modes, backups of data is important. Snapshots of EBS volumes and AMI images of servers go to a hidden part of S3, which you can't export. Depending on your requirements you can backup data to S3, then export S3 data to outside of AWS if you have regulatory requirements or critical data.
    – Tim
    Jan 24, 2020 at 5:21

2 Answers 2

10

You will definitely need a backup! When running a single EC2 instance to host a webserver and that EC2 instance fails, your data will be gone. There are no automatic backups if you just fire up an EC2 instance without further configuration (i.e. make the root volume an EBS volume).

EC2 instances can fail and this must be part of your architectural concept. Usually, AWS announces before an AWS is scheduled for retirement, however, I’ve seen instances fail without any warning. I recommend to regard them as ephemeral and assume that they can fail at any time.

From the AWS documentation:

An instance is scheduled to be retired when AWS detects irreparable failure of the underlying hardware hosting the instance. When an instance reaches its scheduled retirement date, it is stopped or terminated by AWS. If your instance root device is an Amazon EBS volume, the instance is stopped, and you can start it again at any time. Starting the stopped instance migrates it to new hardware. If your instance root device is an instance store volume, the instance is terminated, and cannot be used again.

From https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-retirement.html

Also:

  • Regularly back up your EBS volumes using Amazon EBS snapshots, and create an Amazon Machine Image (AMI) from your instance to save the configuration as a template for launching future instances.
  • Deploy critical components of your application across multiple Availability Zones, and replicate your data appropriately.
  • Regularly test the process of recovering your instances and Amazon EBS volumes if they fail.

From https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-best-practices.html, section Backup and Recovery

So depending on the uptime you’re trying to achieve, it can be advisable not to run just a single EC2 instance, but multiple and add them to a load balancer. Based on a health check you can configure, it will take care of replacing faulty instances automatically.

You might also want to consider hosting your website on AWS Elastic Beanstalk, which can take care of setting up the required infrastructure for you.

1
  • 1
    It's also important to point out that AWS has an explicitly stated Shared Responsibility Model. Essentially, AWS should be considered a utility. They provide the wires, hardware, etc. for you to do your work. But it's still you're responsibility to make sure that you have good security practices, backup strategies, etc. You can learn more here: aws.amazon.com/compliance/shared-responsibility-model
    – scuba_mike
    Jan 24, 2020 at 21:17
1

You need to think about what backups are for. Even if you have a highly resilient web server that is deployed across different availability zones, what would happen if your data or disk got corrupted? You must have a backup to protect yourself for these occurrences.

Amazon do not claim that EC2 instances are resilient in any way but they do provide materials on how to architect a resilient environment using 2 or more instances.

You can find resources for how to architect a resilient environment at https://aws.amazon.com/architecture/

An up to date (2020) guide for EC2 at https://www.logicata.com/blog/aws-ec2-everything-you-need-to-know-about-ec2-instances/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .