From Instances to Functions: Evolution of AWS Compute Resources
Take a walk down memory lane with this look at two of Amazon AWS's most popular serverless compute services, and decide which you need.
Join the DZone community and get the full member experience.Join For Free
Recent surveys and research have made it evident that IT choices are moving towards serverless architecture. It wasn't a long time back when Amazon started providing virtual cloud (IaaS) in the form of Amazon EC2 instances. Over the time, the computing resources have been evolving and we've reached to AWS Lambda as of today.
With the onset of Amazon EC2 as IaaS, AWS wanted to remove the overhead of managing the infrastructure. With the EC2, the time to allocate a server reduced to a fraction along with features like automatic scaling, scheduled provisioning, and monitoring and alerting system powered by CloudWatch.
When EC2 was launched, it prevailed with the far more volatile environment than what it is now. Some of the initial issues were the sudden outage, multi-tenant model per machine, failure in scheduled provisioning and disappearance of virtual machines at all. Some of the popular sites that have been affected due to this are Reddit, Foursquare, Rapportive, and Heroku.
Then came Elastic Beanstalk (EB), which provided all these facilities in a pretty package. EB is available to work with multiple languages and frameworks. With EB, developers can easily upload their code to the virtual machine itself through the AWS console.
Apart from that, EB directly spins up EC2 instances for you while automatically balancing the load and giving you the direct endpoint to use at the end. Even with this, developers can still log into the AWS console and manually configure or tweak the allocation of instances.
With the launch of IaaS, infrastructure management has been removed. It has benefited tremendously to the number of organizations. However, many of the promised advantages have not been fulfilled yet. For example, provisioning and capacity planning is still a major issue based on the manual forecast. To get ahead of this, FaaS was launched.
Amazon released AWS Lambda which is available to work with multiple languages and frameworks. Like Elastic Beanstalk, you can upload your code packages directly to your functions. Unlike Elastic Beanstalk, the infrastructure is not available entirely for the development teams to tweak or manage.
However, the scaling is fully automatic as per the requirements. As said, Lambdas use ECS and these containers are not available to configure manually. On the other hand, Lambdas are exposed through API Gateway which functions as a URL router to your Lambdas.
What Is Amazon EC2?
Amazon Elastic Compute Cloud (EC2) is a virtual cloud infrastructure service offered by AWS. This provides on-demand computing resources through which you can create powerful servers in the cloud.
With Amazon EC2, you have the facility of provisioning virtual machines as per your applications’ requirements. Such facility is provided on a utility based subscription model where the user is billed as per their consumption of resources.
What Is AWS Lambda?
AWS Lambda is an on-demand cloud computing resource offered in terms of Function-as-a-Service by AWS. Over the time, AWS Lambda has changed the way we used to create, architect and run our applications.
With the computing resources like AWS Lambda, the computing resources can scale and descend automatically based on the real-time demands. Presently, AWS Lambda supports multiple languages and can be used within an application in multiple manner or back-end as a service.
Analyzing AWS Lambda and EC2
With more options comes more confusion. To tackle this confusion, here are few points which you need compare before you opt for either of them:
- Setup and Management Environment
- Software package dependencies
- Availability & Scalability
- Use cases
Both EC2 and AWS Lambda works for specific use cases and evaluating them based on their requirements is highly critical.
If you’re wasting your computing resources due to unpredictable traffic for your application, need real-time processing, but still want a scalable and cost-friendly solution, AWS Lambda is for you.
Or maybe you want to run a complex application, need high-performance computing which has a consistent traffic, and want to operate in a tried-and-tested deployment environment, EC2 is for you.
I'd love to hear about your experience with either of them. Hit me up on Twitter @RohitAkiwatkar
Published at DZone with permission of Rohit Akiwatkar. See the original article here.
Opinions expressed by DZone contributors are their own.