AWS Builder Center

Difference between EC2 and AWS Lambda that every AWS learner should know!!!

This Article will discuss about the most confusing services of AWS for the beginners and by the end of this article there will be quiz to check your understanding of the services.

Most of the Beginners (including me (;) faced the issue to understand the two services of AWS
1.AWS EC2 instance
2.AWS Lambda
Let us Understand it one by one with example
AWS EC2 instance is a service provided by AWS which aims to provide a Virtual server according to the developer needs. That means, there is no need to add a physical server or there is no need for an organization to invest in capital expenses. You only pay for the resources that you use
Lets take one example to get to know about it
Assume that you want to build your home from scratch. you have already planned where your bedroom will be, your living room, balcony, bathroom, kitchen and.... you can also add any number of rooms/bedrooms. The infrastructure of your house which also includes the size of the house will be depending on your needs. The most important part you only pay for that particular services provided by the construction people.
the same concept goes with EC2 instance. you only need the infrastructure you can customize your machine like what type of RAM should be installed, Operating System (Image) , network settings, security settings, etc.
Without worrying about use of Physical infrastructure you can directly deploy your application with pay as you go.
AWS Lambda
An AWS lambda is a serverless and event-driven service which allows you to run a code only when it gets triggered by either scaling up or scaling down.
The real world example for this could be the motion sensing light bulb in a room. when there is no one in the room the room will be dark but as soon as the sensor detects the motion of a person (when a event occurs) then the light bulb is turned on in the room and remains on until there is again no motion detected.
Instead of again again keeping track of load on your instances you basically can use AWS Lambda by writing a code to scale up or scale down according to the load on your instances.
Quick knowledge check
A company is designing a serverless web application that experiences sporadic traffic with long periods of complete inactivity. Which AWS service should be used to run the backend application logic while minimizing idle costs?
a. Amazon EBS
b. Amazon S3 Glacier
c. Amazon EC2
d. AWS Lambda
An administrator needs full root access to the operating system of a virtual server to install custom monitoring packages and configure kernel-level network settings. Which AWS service best fits these requirements?
a. Amazon S3
b. Amazon IAM
c. Amazon EC2
d. AWS Lambda
let me know the correct answer down in the comments
I hope you liked my article
Please leave a comment on which services should i make the article on next.
Happy Learning!!
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article