Comparing AWS Framework: Serverless better than Amplify

One of the most important and growing platforms is AWS (Amazon Web Services) when it comes to serverless technology.  There is a variety of open source and third-party frameworks that simplify serverless application development and deployment.

My journey in the serverless computing space started with the search for a perfect framework that supports JavaScript and would make me accomplish my requirements with ease. Two of the best ones that I had to pick between were the Serverless Framework (a third-party open-source framework supporting other cloud platforms) and the Amplify Framework (developed by AWS). I tried both of them. The remaining part of this article is my findings, which would help you decide on the framework you should choose for your project. I’ll split my views into Ease of Development, Services Supported, Local Development Testing, Documentation and Community Support, Plugin Availability, and CI/CD and compare the frameworks within each section.

Ease of Development

Comparing AWS Framework: Serverless better than Amplify Image 1

Both frameworks provide CLI-based development. In Serverless Framework, you can start the development by using one of the templates provided for the language you use. In my case, since I use JavaScript, I can use the command given below:

SLS create –template aws-nodejs

To deploy the application to AWS, we only need to use a single command given below:

SLS deploy

Amplify provides UI Components for front-end frameworks such as React and creating and managing the back end. We can use the command below to create an Amplify application:

amplify init

To add/remove a specific service, we can use the following command:

amplify <category> add/remove

Here category is one of the different ones supported by Amplify, and each comprises different AWS Services.

To deploy an amplify application, we can use the following command:

amplify push

As you can see, both frameworks provide CLI commands to easily develop and deploy your serverless application in less than 3 commands. But Amplify provides a CLI command to easily create different AWS services by answering some prompts, which is not present in the serverless framework when writing this article. So Amplify slightly edges out Serverless Framework in this area.

Services Supported

  1. Amplify currently supports the following categories:
  2. auth (Amazon Cognito), 
  3. storage (Amazon S3 & Amazon DynamoDB)
  4. function (AWS Lambda)
  5. API (AWS AppSync & Amazon API Gateway)
  6. analytics (Amazon Pinpoint)
  7. hosting (Amazon S3 and Amazon CloudFront distribution)
  8. notifications (Amazon Pinpoint)
  9. interactions (Amazon Lex)
  10. predictions (Amazon Rekognition, Amazon Textract, Amazon Translate, Amazon Polly, Amazon Transcribe, Amazon Comprehend, and Amazon SageMaker)

These are the services supported by Amplify out of the box. When we add a category using the command mentioned in the previous section, it creates the necessary CloudFormation syntax for the resource. It adds it to a JSON file maintained by Amplify, which is then deployed to AWS. We can add other services which the CLI does not directly support by manually editing this CloudFormation file. But a small issue I found is that the CLI overwrites the same file when we add/remove a category. This can undo the changes that we made to the file.

Serverless Framework, on the other hand, has no pre-defined set of supported services. Since it uses an abstraction of AWS CloudFormation syntax, we can add any service as a resource using the same. It uses a serverless.yml file that contains all the infrastructure resources defined. Once we deploy the application, it generates AWS CloudFormation, which creates a CloudFormation stack in AWS.

So, in my opinion, the Serverless Framework is more flexible in terms of the services supported. Even though we can manually edit the CloudFormation in Amplify, it is not as straightforward or hassle-free as the Serverless Framework.

Local Testing

The first thing we can notice when starting with Amplify is that it promotes GraphQL more than REST. For example, I want to use the AWS ElasticSearch service for my project. But it is only directly supported by GraphQL. I want to use REST API endpoints with AWS ElasticSearch service, which is not possible out of the box.

Similarly, in the case of testing my REST API endpoints locally, I couldn’t find a way with Amplify at the time of writing this article. Sadly, it provides a way to mock GraphQL endpoints using a single command, not what I want.

Serverless Framework has a plugin that supports offline testing of the REST API endpoints, and it also has a plugin for creating a local instance of DynamoDB. It even has a plugin to test the DynamoDB streams locally, which I’m using in my project.

As per my requirement, the Serverless Framework provides far better local testing abilities than Amplify.

Documentation and Community Support

Both frameworks provide excellent documentation. But I found more examples of different services for the Serverless Framework. I think this is because the Serverless Framework has been here for quite some time. So it has a comparatively large community of users than Amplify.

I encountered several different issues with both of the frameworks. In such cases, the Serverless Framework community was more helpful in resolving them. Since Amplify is quite new, most of the issues encountered were bugs that weren’t resolved. But, there were some workarounds for the same, provided by the community, which were useful.

In this section also, Serverless Framework continues to shine as compared to Amplify.

Plugin Availability

As we saw in the local testing section, Serverless Framework has a wide variety of plugins available. There are certified and approved plugins by Serverless Framework Team, and there are also community-built ones. These plugins make it easy to add new functionality to the framework without having to add them manually.

Amplify has a minimal number of plugins as compared to Serverless Framework, but the Amplify CLI provides a way to create our own plugins using the command below:

amplify plugin init or amplify plugin new

In terms of plugins, the Serverless Framework is again far ahead of Amplify.

CI/CD

Amplify provides a way to implement CI/CD of your full-stack application through the Amplify Console. We can associate our Amplify application repository with Amplify Console. It is pretty straightforward to set up. But in my experience, CI/CD was a hit or a miss. Some of the time, I came across some weird issues. But when it works, everything is flawless.

In Serverless Framework, we can implement CI/CD for the back end using AWS CodeBuild, CodeDeploy, and CodePipeline. We can add the necessary CloudFormation to the serverless.yml to create the deployment pipeline in AWS.

Even though Amplify has its own issues, it provides CI/CD for the full stack of our application, which is not the case with the Serverless Framework. So I feel it provides a more complete CI/CD solution than the one offered by Serverless Framework.

 

Conclusion

Serverless Framework is a more established framework than Amplify. It has the upper hand regarding the different AWS services it provides, local testing, community support, and plugin availability.

On the other hand, Amplify provides an easy-to-develop and deploy CLI and a more complete CI/CD solution than Serverless Framework. It is still an excellent option to try out. I’m sure that they will add more in the coming months in terms of the services supported. Also, community support will only increase as more developers jump on the bandwagon.

In my opinion, Serverless Framework is by far the best framework you can consider currently if you are looking for a completely serverless solution for AWS.

 

 



Author: Deepak P C
Deepak P.C is a technology enthusiast with 7+ years of experience in software development. He is a skilled JavaScript and AWS engineer by profession and an avid PC gamer by passion. He has been working with InApp for the past 1.5 years.

5 Comments

  • Parvathy PB

    Highly informative …simple to read..great job.

  • Robin Reni

    Thanks for the blog . I have a doubt Serverless in AWS comes with great limitations ryt . When we use AWS lambda it’s RAM limited to 3GB and 2000 concurrent functions . Is there anyway to overcome this limitations and run high-end codes ?

    • Deepak P C

      I think you referred to CPU/RAM intensive workloads with “high-end codes”. In the case of Lambda, CPU power is allocated based on the memory allocated. If you allocate memory sizes above 1.8GB, a multi-core CPU is allocated. You can allocate up to 3GB memory as you mentioned. If you want more processing power and memory, you can use the more flexible Amazon EC2 service. This is more like a virtual server and can be configured to have very high-end specifications. But this has limitations as compared to a Lambda service. You will be responsible for provisioning capacity, monitoring the health and performance of the server, and designing for fault tolerance and scalability. Also, the cost of the EC2 service depends on the type of instance you opt for.

  • Anonymous

    Nice Article…Very interesting to read this article. I have learned some new information. Thanks for sharing.

Leave a Reply

seven − 2 =