[Hello World] today lets tackle AWS Instance types and Right-sizing

Reginald Bratton
8 min readOct 26, 2023

--

Today we are going to visit a scenario where you need to change your EC2 instance type!

Before we get into the nitty gritty think of your EC2 instance as a server.

Today our scenario is right sizing our EC2 instance because the instance type we currently have does not have the requisite amount of memory and is not optimized for the workload that we need.

As the founder of Reginald Bratton INC I have consulting firm I have a new client that needs some consulting…CMS runs a class schedule for the students that are in their honors program. The school has one of the top honors programs in the country. Since CMS was recently featured on the Good Morning America they have a influx of transfer students. Its a week before school and they need more memory because they have nearly triple the amount of students compared to last year and they have nothing to support all of the new students!!!

Our task is to change the instance type to a larger instance type (server) to support the influx in students and to be able to save their class schedules but also their /grades/essays/ recommendation letters to make sure we have all of the students ready for college!

We’ll start with our EC2 instance. AWS Computing Solutions

view Instance ID Public IPv4 address

Next click Instance types.

If you look closely you will see that there is memory allotted to each instance type. Starting with the t1.micro with .612 memory and the largest one in this picture is the t2.large with 8 GIB memory.

Its really important to right-size your instance meaning choosing the correct size for whatever type of instance you are trying to run. The beauty of AWS is that you can always change your EC2 instance type (server) to meet your business demands (scalability) which is the ability to add more resources at the touch of a button (CPU/RAM/Memory) to your instance.

For our lab we are using: t.3.large, c.5.large, r5.large instance types

One important thing to understand is if you scroll down in your details you can see what these resources will cost you. Another beautiful thing about AWS you can take the guessing and throw it out the window when you are trying to build a instance! We do have AWS Cost Explorer as well but for this lesson we are just going to briefly discuss instance types.

Click back on instances and copy public IPv4 address to clipboard. DO NOT Click Open Address

Pro-tip…if you copy/paste the Public IPv4 address in a new browser this is what you will see.

Instance ID, instance type, availability zone, instance family

When you are hosting a EC2 instance the public IP address is what is available to everybody on the public internet. Inside your AWS cloud you have the VPC and inside the VPC you have the instance is running in a availability zone. In your availability zone you have public or private subnets and inside the subnet you will have the EC2 instance.

A little more info on connecting VPC’s visit my page…but we are moving forward https://medium.com/@reginaldbbratton/hello-world-41870b38eb7b

You can always change your access from public to private. For example you can host this instance on a private IP address which is not available to anybody on the internet.

Next we are going to connect to our instance

press connect

You will be connecting to the instance using the session manager

Next highlight EC2 instance connect

Our concept here is that the EC2 connect makes it easier and secure to connect to your Linux instances. EC2 instance connect uses AWS IAM policies and principals to control SSH access to your instance without you have to share and manage SSH keys. Policies include allow/deny or read only access.

you will see the CLI later on…just wait :)
key pair is needed to connect to instance for security!

Head back to session manager and connect

Once you press connect your AWS CLI will pop up

Here we need to provide access. To provide root privileges press sudo -i.

Root access is where you can make the wholesale changes to your instance and give out permissions, create policies, user groups, basically anything you need to do.

To change the application directory. Enter the command:

cd ../home/ec2-user/sample_app

To list all the files use: ls

tail -lf aws_compute_solutions.log

Final screen shot should look like this (below) and you should review: aws_commute_solutions.log. I zoomed in so root is missing for the sake of visibility but the command line starts with root@ip-10–10–10–10

Head back over to instances

This is how you control the instance state and modify instance attributes (capacity, ram, memory)

review

Head back over to instances

Now we are going to stop our instance. You can start and stop instances if it has an Amazon Elastic Block Store (Amazon EBS) volume as its root device.

Confirm you would like to stop the instance

Instance stopped

Notice there is no Public IPv4 address because the instance is stopped there is no way to give our access for the server(EC2 instance) if you have stopped it

When we speak about Pay-as-you go this is a great example. No need to sign long-term contracts and be locked in to them if possible

Head back over to instances

Pro-tip…we will need to change our instance type in this lesson so this is where you can change it. Remember what we discussed earlier about the different instance types can support more or less capacity and right-sizing helps provide the best price point for your instance.

Instance types comprise varying combinations of CPU, memory, storage, and networking capacity and give you the flexibility to choose the appropriate mix of resources for your applications.

Now when we start our instance you can see that now we have the IP address is backkkkkkk.

We can send out our IP address to our client if they need to see what we have been working on.

In AWS Cloud Quest there is a section for DIY.

This should be easy peesie!

Head back over to instances:

  1. Stop the instance first (cannot change the type while instance is running)
  2. Click instance types and press X to clear all instances.

Our lesson calls for m4.large

3. Now head back to instances and you can see that the change instance type is not greyed out.

Press change instance type and find m4.large

Now you need to head back over to instances and start your instance!

green=running!

For our mission we need to copy the instance ID and you can see the Instance Type is m4.large

Once you click on the instance ID

Now Copy/Paste the Public IPv4 address to a new browser. Instance type is now m4.large

Before:

Lastly remember right sizing will and can be a on-going process. You just never how much capacity you are going to need but leave that up to the cloud! And when you have provisioned more resources and you do not need them any more you can right-size (scalability) them back to a smaller instance type which can save you money hence the pay-as-you go and flexibility.

Right sizing is the most effective way to control cloud costs. It involves continually analyzing instance performance and usage needs and patterns — and then turning off idle instances and right sizing instances that are either overprovisioned or poorly matched to the workload. Why pay for something that you do not need????

If you like spending money lets connect over some medium roast JOE!

Thanks again for your time!

Lets Colab/Connect :)

https://www.linkedin.com/in/reginald-bratton-388a0754/

--

--