Exclusive Whitepaper
Navigating the FinOps Landscape: A Comprehensive Market Analysis

How to optimize AWS EC2 instances and save costs by migrating to an ARM processor?

Ratan Karan Srivastava
By Ratan Karan Srivastava
18 Aug, 2023

Introduction

AWS EC2 provides stability in computing, networking, and handling a request. AWS provides different types of options when choosing any virtual machine that contains different CPU, Memory, and networking capabilities with all that AWS also provides options in processors as well.

While choosing a processor for your VM can improve the performance as well as it will impact the pricing. By selecting a processor aligned with your requirements, you can boost efficiency and potentially realize significant AWS cost savings.

Advanced RISC Machine (ARM)

ARM is an architecture used in chipsets and requires a much smaller instruction set. This type of processor architecture is commonly used in mobile devices and other small devices. ARM processors refer to the CPU architecture designed by AWS that is optimized for cloud workloads. 

ARM processors are available for use in Amazon EC2 instances, which offers secure and resizable compute capacity for virtually any workload. It offers up to 32 cores per processor, making them well-suited for workloads. These are more cost-effective than other processors.

Advanced Micro Devices (AMD)

AMD processors are a type of processor architecture commonly used in servers, laptops, and gaming consoles. It is based on the Zen architecture and is designed to offer high performance and scalability for cloud workloads. AMD processors are better suited for workloads that require a high level of parallel processing and scalability. AMD gives you all the tasks at once.  It offers up to 64 cores per processor, making them well-suited for workloads.

Cost Impact on Using ARM

ARM processors are more cost-efficient than AMD and will provide scalability and availability according to the requirements.

Migrating running infrastructure from AMD to ARM

To migrate running infrastructure from AMD to ARM contains some steps and prerequisites by which we can do that in a practical way, Below mentioned steps are helpful in that.

Step 1: The beginning of this migration starts with creating a multi-architecture image of your Java application which can run on both AMD and ARM-type processors and promises zero downtime while migrating your services.

Docker Buildx does the same for you and allows you to create a multi-arch image of your services.

Set-up docker buildx

Install Docker on Server

ADM to ARM
Install Git

ADM to ARM
Setup Docker Buildx on the server

ADM to ARM
Vim into the daemon.json file and paste the content.

AWS EC2 Cost optimization
AWS EC2 Cost optimization

save exit

AWS EC2 Cost optimization

AWS EC2 Cost optimization

Experimental = true indicates the following command works

Check buildx working

AWS EC2 Cost optimization

Step 2: Build and push all the java services docker files using docker buildx and push to ECR.

Sample docker-file

AWS EC2 Cost optimization

Command to build and push the image to the ECR.

AWS EC2 Cost optimization

--push will push the image to the ECR repository

Step 3: Hosting on AWS EKS

Set up node-group on AWS.

Create all docker base images using buildx and push them to ECR. 

Create a Docker file that can support buildx creation.

Create a new version of the launch template from the existing node group.

Use arm AMI in the launch template.

Using a new version of the launch template, launch a new node group and provide a graviton-type instance in ASG.

After the successful creation of a new node-group delete the old node-group after that uninstall all services and deploy using the docker buildx command.  

Handle docker buildx volume

In the server where the docker buildx is configured check the location cd /var/lib/docker/volumes/ id there is any buildx volume is creed and size get increased after each buildx build you have to create a cron job for 

AWS EC2 Cost optimization

The command has to be run periodically according to the number of deployments.

If you are looking for a trusted partner in your journey of AWS cloud cost optimization and maximizing the value of your cloud investments, book a demo now and see how CloudKeeper can help.

0 Comment
Leave a Comment