I'm running an EC2 instance using Ubuntu 20.04 to host 4 small personal websites (1 .NET Core and 3 WordPress) and I want to ensure a regular backup schedule, mainly because I'm fairly new to Linux and setting up this server took FOREVER, and I'm afraid to update packages etc. just in case it breaks everything and I have to start over! I eventually intend to have the WordPress websites use a separate RDS instance for the MySQL databases and create daily backups, but they're on the same server at the moment.
I set up an automated backup schedule last night (Friday) to run every Saturday at 5am for my EC2 instance and the attached EBS volume, but I have a few questions about it which I hope you folks might be able to help with:
If I'm backing up my EC2 instance, do I actually need to backup the attached EBS, or is that included?
The EBS backup took 15 minutes, but the EC2 backup took over 5 hours - is this normal? The EBS volume is 20gb, both backups say that the backup size is 20gb.
What is actually backed up for the EC2? Documentation implies "configurations etc.", but surely that would take no time at all and the size of this backup would be negligible?
Documentation advises that backups are incremental, so for the EBS volume the first backup would be 20gb, and any made after would just be the size of the changed data. However, if I schedule backups to expire after 30 days, what happens if I need to restore last week's incremental backup if the original full 20gb backup has since expired?
Is what I'm doing/planning to do for backups correct/cost effective, or are there better solutions?
Any help is appreciated.
If I'm backing up my EC2 instance, do I actually need to backup the attached EBS, or is that included?
As per this post the EBS appears to be included:
When you back up an EC2 instance, AWS Backup will protect all EBS volumes attached to the instance
The EBS backup took 15 minutes, but the EC2 backup took over 5 hours - is this normal? The EBS volume is 20gb, both backups say that the backup size is 20gb.
I would not expect this to be the case. Have you tested this out on a really small instance with a really small EBS? That would give you an idea of what is backed up on how long it takes.
Did you schedule this to happen in a backup window or immediately? Perhaps there was some backup period like RDS has and it was completed then?
What is actually backed up for the EC2? Documentation implies "configurations etc.", but surely that would take no time at all and the size of this backup would be negligible?
See first point.
Documentation advises that backups are incremental, so for the EBS volume the first backup would be 20gb, and any made after would just be the size of the changed data. However, if I schedule backups to expire after 30 days, what happens if I need to restore last week's incremental backup if the original full 20gb backup has since expired?
I would expect that the incremental data required would persist. It would be worth testing this to dobule check but I wouldn't expect AWS to store a partial back up of some kind. Your data should be recoverable to a point in time.
Is what I'm doing/planning to do for backups correct/cost effective, or are there better solutions?
We'd need to know your use case a little more to answer this but I can make some assumptions that there could be a more cost effective solution. Wordpress generally has very few files and folders which need backing up. A wordpress install is tiny even if you include the theme, plugins and config. Assuming that you only want to store that data, you could probably save money by just zipping your wordpress install up and storing it in EC2 for 30 days.
To reduce the size of the backups you could also store some of your content like images in AWS S3 and use cloudfront to serve them up. You may find that if you grow to have many images on your site that this may be cheaper than EBS. You'd need to do the math.
However, you have said that you are nervous about updating packages etc and if this is the case then you may be more confortable backing up the whole instance with packages and data etc.
Another option you may wish to consider but is much more advanced than what you are doing now could be to use ECS and deploy docker images to run the site instances however you may struggle with this without support.
There are definitely other ways to achieve backup but if you're not super comfortable with linux and installing and running wordpress then I'd recommend sticking with the ECS + EBS back ups for now or to use a managed service from wordpress.com rather than hosting your own instances.