Amazon EC2 is an elastic computing cloud provides scalable computing capacity in the AWS cloud. With Amazon EC2, you can eliminate the need for investing in hardware up front and this is easy to develop or deploying apps faster. Also, you can launch as many instances as possible.
To know how to launch your own first EC2 instance, click here. Using EC2, you can use as many or a few virtual servers as needed, configure security settings, and manage the storage. It helps you to scale up or down to handle changes in requirements based on project needs.
Amazon EC2 Instance Types
When you know how to launch an EC2 instance, this is the time to specify the instance type that can be used for the host computer. Each instance type offers different computing capabilities, memory, storage and they are grouped together based into instance families ahead.
Your role here is to decide on the type of instance based on application requirements that you plan to run on your instance. Each EC2 Instance had a consistent and predictable amount of CPU capacity regardless of their underlying hardware.
Using EC2, a few resources of the host computer can be dedicated to the particular instance like CPU, instance storage, or memory etc. it could share other resources of host computer too like network, disk subsystem among multiple instances.
If any particular instanced is overused or underused then loads are shared among instances accordingly. Each instance type offers higher or lower minimum performance from shared resources.
Read: How AWS Shared Responsibility Model Strengthens Cloud Security?
Consideration to focus on when resizing an Instance type
As per your needs, you may find your instance either over-utilized or under-utilized. If this is the case then you should change the size of instance based on requirements.
For example, if your instance is too small as per the workload then you should change it to another instance type that is appropriate for the workload. In a few cases, you may be interested in migrating from older instances to new generation instance types to take advantage of some extra features and support for IPV6.
In case, the root device for your instance is an EBS volume then you can resize instances by simply changing its instance type. The process is known as the resizing instance types here. If the root device for the instance is an instance store volume, you might want to migrate your application to a completely new instance by defining the type you need.
When you are resizing an instance, you should select an instance type first that is compatible with the configuration of the instance. If there is some compatibility issue then you should migrate the application to a new instance with a particular instance type as required.
Every time you are resizing an instance, the resized instance had the same number of instance store volumes as specified when the original instance was launched. To add more instance store volumes, you should migrate the application to a new instance by specifying the instance type and instance store volumes. One exception to the rule when resizing to storage-optimized instance types that by default it contains a higher number of volumes and you can use them based on requirements.
How to check the compatibility of EC2 Instances?
You can change the size of an instance only if it is compatible in the following ways:
Read: Is the AWS Big Data Certification Worth It? Learn How to Pass Certification In First Attempt
- Virtualization Type: Linux AMIs are using one of two types of virtualizations that are PV (paravirtual) or HVM (Hardware Virtual Machine). You cannot resize an instance that was launched from PV AMI to an instance that is HVM only.
- Architecture: AMIs are always specific to the processor architecture, so you should always select an instance type with the same processor architecture as the current instance type.
- Network: Fresh instances should be launched within a VPC. You cannot resize an EC2 classic instance to an instance that is available only in a VPC unless you have a nondefault VPC. For this conversion, you first migrate the Linux instance from an EC2 classic platform to a Linux instance in a VPC.
- Enhanced Networking: To support the enhanced networking within instance types, you need necessary drivers installed on your system.
Steps for resizing an AWS EC2 Instance
This is vital stopping an instance before you change its instance type. When starting or stopping an instance, you need to focus on the following steps:
- When we are shifting an instance to a new hardware, its ID would remain the same.
- If your instance has a public IPV4 address then release the old address and give it a new public address. It will retain its private address, any Elastic IP address if available or IPV6 addresses too.
- If an instance has an auto scaling group, then it will mark the stopped instance as unhealthy and it may be terminated and you need to launch a replacement instance here. To avoid this, you should suspend the scaling process for the group when resizing an instance.
- Make sure that you are ready for the downtime when the instance is stopped. Stopping or resizing an instance always takes time and restarting an instance will take a viable amount of time-based on startup scripts of an application.
Once you are sure of all considerations to keep in mind when changing the instance settings, this is time to make real action using the AWS Management Console.
- This step is optional but may be required in a few cases. If any new instance requires drivers that are not installed for the existing instance then connect to your instance first and install the necessary drivers first.
- Now open the Amazon EC2 Console and start your work.
- In the navigation pane, choose the option Instances and select the Instance.
- Further, you can choose actions, state for an instance, choose to stop an instance.
- In the confirmation dialog box, choose yes, Stop. It will take some time for any instance to stop.
- With the particular instance selected, choose actions, select instance settings and then choose “change instance type”. Keep in mind that you would not be able to see this option if the instance is not stopped yet.
- In the dialog box for change instance type, perform the following steps ahead.
- Choose the instance type first that you need. If the instance type does not appear in the list then it is not compatible with the configuration of your instance. Reasons could be any as discussed earlier in the compatibility section like virtualization type, networking etc.
- In the end, choose Apply to accept the new settings.
- Once changes are made successfully to the selected instance, this is the time to restart the stopped instance. For this purpose, select the instance first then choose actions, select the instance state then choose the Start option.
- From the confirmation dialog box, choose the option Yes, Start. It will take some time for any instance to enter the running state. So, you have to be a little patient in that case.
- If your instance was not booted successfully then it could be possible one of the requirements for the new instance was not met. So, you have to be extra mindful and cautious while changing the state or type of an instance.
Steps for Migrating an AWS EC2 Instance
When you wanted to move a particular instance to any other instance type, you must migrate it by creating an image of your instance and launch a new instance by defining its state or type properly. To keep the hosting uninterrupted, take the elastic IP address associated with the original instance and associate the same with the new instance. Once it is copied, you can terminate the original ones.
Here are a few steps to follow while migrating an AWS EC2 Instance:
- Take the backup of instance store volumes first that are needed for the persistent storage. Now detach the data from the original ones so that it can be associated with the new instance.
- Now create an AMI and there are certain prerequisites for the same that you need to follow. Once you are done with AMI creation the move to step 3.
- Now open the Amazon EC2 Console. From the navigation pane, select AMIs owned by you and select the image that was created in the first step. You can cross check the AMI with its name that was given during its creation. In case, you didn’t find the AMI you created in step 2 then select the region again where it was saved.
- Choose the Launch option moving ahead and decide on the instance type wisely. Remember that you are terminating the original instance only not the new ones. To avoid any confusion, you may check the launch time too. For this purpose, choose actions, select instance state, and choose to terminate.
How to change the different instance settings?
There are different instance settings like security groups, tags, termination protection etc. that you need to work on when modifying an instance other than resizing it. Let us discuss on most important instance settings that should be learned or practiced thoroughly.
Create or Edit Tags
You can always add or edit tags assigned to an instance when necessary. Tags will make the tracking of instances easy especially when there are multiple environments. Let us how to edit tags in the AWS EC2 Instance.
Read: What Should You Know About AWS Elastic Load Balancer?
- Click on Instance Settings and choose the “add/edit tags” option.
- A tag is a key-value pair, so give values for both parameters and click on Save option.
- Now go back to the EC2 Instance Dashboard and select your instance again, here changes will be reflected clearly made recently.
Attach to an auto-scaling group
- Click on Instance Settings and choose the “attach to auto-scaling” option.
- Here, you can attach an instance to an existing AS group or you are free to create new AS group too based on requirements.
- In the last, click on Attach option and you are done.
Change the Instance State
You can change the state of an instance from the AWS management console with a single click only. Three popular states of an instance can be defined as given below.
- Stop – Here, you can stop the running state.
- Reboot – This is used to reboot an instance
- Terminate – This state is used to terminate an instance permanently.
For this purpose, go to the Instance State option on the EC2 Dashboard from the navigation pane and click on the desired state like Stop, Reboot, or Terminate.
Change the Instance Type
- To change the type of Instance, go to the Instance Settings option and click on change Instance type option.
- An Instance type popup box will appear in front of you.
- Here, you can select the particular instance type from an available range of instance types. Keep in mind that each instance type has specific meaning so you should be sure of its meaning why you need it.
- Once you have selected the desired instance type, click on the Apply button given in color Blue.
- Now you may check the description of the instance where its type has been changed automatically and reflected other users as well.
- There will be changes in other configuration settings and existing installations on the server would remain intact.
Enabling Termination Protection
It will add an additional level of security if you click the terminate option by mistake. This step will make sure that no instance is terminated accidentally but intentionally.
- Go to the Instance Settings first and choose the “Change termination protection” option here.
- If the current setting of your Instance is disabled then click on Yes to Enable.
- Now Select the instance state, click on the Terminate option. AWS will immediately notify here that instance is termination protection enabled and will not delete it accidentally.
Change the User Data
To change the user data, go to the Instance Settings first and choose the view/change user data option. Now modify or edit the user data fields and click on Save option in the end.
Change the shutdown Behavior
- To change the shutdown behavior, go to the Instance Settings first and choose the change shutdown behavior option.
- Now choose the shutdown behavior and click on the Apply button in the end. Now shutdown behavior will change accordingly.
View System Log
- You can see the system log for any EC2 Instance for troubleshooting purpose. For this purpose, go to the Instance Settings first and choose the “get system log” option.
- A separate window will appear in front of you where you can view the system log. You can also check when instanced were restarted or stopped.
Create an Instance AMI
- To create an AMI of EC2 Instance backup, Go to Image and click on create image option. One image wizard will open in front of you.
- Here, you have to add all necessary details related to the image like Image Name, Image Description etc and hit the create Image option in the end.
- AWS will receive the request and respond you back immediately.
Change the Security Group Settings
- To change the security group for an instance, Go to Networking and choose the “Change Security Groups” option.
- In the security group wizard, it will give you the list of all available security groups for existing instances.
- Tick the box against the desired security group and click on the Assign security groups button in the end.
- From the EC2 dashboard, you may check that security group for the instance has been changed.
Add/Create a Network Interface
- For this purpose, Go to Networking and choose the “Attach network interface” option.
- It will show an error if the network interface is not created already. So, create the network interface first then attach it to the EC2 Instance.
- To create a network interface, go to the EC2 dashboard and choose on Network Interface option in the left pane.
- Here, you need to give complete details for the network interface like description, subnet, security groups etc. Click on “Yes, Create” option in the end and your network interface will be created successfully.
Dissociating Elastic IP address
- An elastic IP address is the static public IP that can be dissociated directly from the EC2 dashboard. Let us see how to do it.
- Go to Networking, and choose the “Dissociate Elastic IP address” option.
- One popup box will appear where you can click on “Yes, Dissociate” button to make the EIP field black for the instance.
Manage Private IP addresses
- You can assign multiple private IP addresses to an instance based on your application architecture. The maximum number of IP addresses that can be assigned depends on EC2 Instance type.
- To assign multiple IP addresses, go to the Networking and choose the “Manage IP private addresses” option here.
- Now you can auto-assign any available IP address and click on Update button.
- Go to the EC2 Dashboard and check either Private IP addresses are assigned successfully or not.
The process may sound tough at the first glance. With little practice and efforts, you can always learn the process like a pro. Still, you encounter any problem then join our course for AWS certification and master everything from scratch.
Read: AWS Tutorial for Beginner - A Detailed Guide to Cloud Computing
- AWS & Fundamentals of Linux
- Amazon Simple Storage Service
- Elastic Compute Cloud
- Databases Overview & Amazon Route 53
-1 day 04 Feb 2023
- Intro to DevOps
- GIT and Maven
- Jenkins & Ansible
- Docker and Cloud Computing
5 days 10 Feb 2023
- Data Science Introduction
- Hadoop and Spark Overview
- Python & Intro to R Programming
- Machine Learning
-1 day 04 Feb 2023
- Architecture, HDFS & MapReduce
- Unix Shell & Apache Pig Installation
- HIVE Installation & User-Defined Functions
- SQOOP & Hbase Installation
-1 day 04 Feb 2023
- Salesforce Configuration Introduction
- Security & Automation Process
- Sales & Service Cloud
- Apex Programming, SOQL & SOSL
6 days 11 Feb 2023
- Introduction and Software Testing
- Software Test Life Cycle
- Automation Testing and API Testing
- Selenium framework development using Testing
-1 day 04 Feb 2023
- BA & Stakeholders Overview
- BPMN, Requirement Elicitation
- BA Tools & Design Documents
- Enterprise Analysis, Agile & Scrum
1 day 06 Feb 2023
MS SQL Server
- Introduction & Database Query
- Programming, Indexes & System Functions
- SSIS Package Development Procedures
- SSRS Report Design
5 days 10 Feb 2023
- Features of Python
- Python Editors and IDEs
- Data types and Variables
- Python File Operation
12 days 17 Feb 2023
- Components of AI
- Categories of Machine Learning
- Recurrent Neural Networks
- Recurrent Neural Networks
6 days 11 Feb 2023
- Introduction to Machine Learning & Python
- Machine Learning: Supervised Learning
- Machine Learning: Unsupervised Learning
19 days 24 Feb 2023
- Introduction to Tableau Desktop
- Data Transformation Methods
- Configuring tableau server
- Integration with R & Hadoop
-1 day 04 Feb 2023
Receive Latest Materials and Offers on AWS Course