Resizing an EC2 instance requires stopping the instance, changing the instance size (more/less CPU/memory) and then start it again (steps here). For a single instance, this would cause a temporary outage of that instance.
To automate, AWS Systems Manager can run automations, including executing API calls. There's an automation document for resizing an instance you could leverage. In order for this to kick off in response to an event, you could create a CloudWatch to trigger SSM based on instance load (assuming you're logging the proper metrics to CloudWatch, by default CPU is tracked but not memory unless you enable it).
Instead of based on load, you could leverage CloudWatch to trigger events based on time, so if the backups occur on a set schedule, you could upsize beforehand and downsize after.
Regarding backing up, you could instead create and manage backups without causing any interruption by using AWS Backup to take snapshots of the instance's EBS volumes. Should you ever need the data back, you can create a volume from the snapshot to copy the data off or, if the whole instance needs to be reverted, replace the EBS volume from a prior snapshot.
Relevant questions
AWS Backup - two ec2 instances are assigned as the protected services - but I see an EBS snapshot in the vault?
asked 7 months agoCli "Unable to locate credentials" on EC2 instance
asked 2 months agoEC2 upgrade fails and rollsback
asked 3 years agoHow can i upgrade ec2 instance everyday for sometime only?
asked 21 days agochange EC2 parameters (cores, RAM) after I have installed a GUI and some softwares
asked 7 months agoMemory and CPU allocation for EC2 on Free Tier.
asked 5 months agoEC2 Instance stops working after some time
asked a month agoHow to keep a process running on my EC2 instance via cloud9
asked 3 years agoA new EC2 instance is created after termination of the only instance
Accepted Answerasked 2 years agoRandomly unable to connect to ec2 instance from some networks
asked 6 months ago