This documentation outlines the process of upgrading an AWS instance from a c5.xlarge to a recommended c5.2xlarge configuration. In addition, it includes steps to separate Redis and add swap memory to optimize performance and address high CPU utilization issues.
Before you begin the upgrade, ensure you have the following prerequisites in place:
- AWS account credentials with administrative access.
- Access to the AWS Management Console or AWS CLI for instance management.
- Existing AWS instance (c5.xlarge).
- A clear understanding of your server's configuration and applications running on it.
In the interest of improving system performance and security, it is recommended to separate Redis from the primary server. Here's how to do it:
- Log in to the AWS Management Console.
- Navigate to the EC2 Dashboard.
- Click "Launch Instance" to create a new instance.
- Choose an appropriate Redis instance type (e.g., Amazon ElastiCache or EC2 with Redis installed).
- Configure the security groups, network settings, and storage as required.
- Launch the instance and ensure Redis is up and running.
- Update your application's configuration to point to the new Redis instance.
- Modify security groups and access control settings to allow communication with Redis.
To upgrade your existing c5.xlarge instance to c5.2xlarge, follow these steps:
-
Log in to the AWS Management Console.
-
Navigate to the EC2 Dashboard.
-
Select your existing c5.xlarge instance.
-
Stop the instance to prepare for the upgrade.
-
Click "Actions" > "Instance Settings" > "Change Instance Type."
-
Select the "c5.2xlarge" instance type and confirm the change.
-
Start the upgraded instance.
Adding swap memory can help alleviate RAM usage issues. Here's how you can add swap memory to your server:
-
SSH into the upgraded c5.2xlarge instance.
-
Run the following commands to create a swap file:
sudo fallocate -l 1G /swapfile sudo chmod 600 /swapfile sudo mkswap /swapfile sudo swapon /swapfile
-
To make the swap permanent, add the following line to the
/etc/fstab
file:/swapfile none swap sw 0 0
-
Adjust swap settings for improved performance. Edit
/etc/sysctl.conf
and add or modify the following lines:vm.swappiness = 10 vm.vfs_cache_pressure = 50
-
Apply the changes with the command:
sudo sysctl -p
-
Ensure the swap is active and working:
sudo swapon --show
-
Verify that the system is using swap when needed, reducing RAM usage.
By following these steps, you have successfully separated Redis for V14, upgraded your AWS instance, and added swap memory to optimize its performance. These actions should help alleviate CPU and RAM utilization issues, resulting in a more reliable and responsive server.