To main site
Back for more posts
Tech
AWS
Amplify
Share:
3 min read - 534 words
Date published: 19-Feb-2023
Date modified: 19-Feb-2023

Quick Intro to AWS Amplify

The general consensus of my website is it is too complicated and I have committed over-engineer sin. What if I told you there is a super tool (free to use) that you can spin it up similar infrastructure just as well in no time, with minimal maintenance. Today, I want to share about Amplify, a CLI and UI tool that can bootstrap your infrastructure. Disclaimer: Amazon did not pay me for this (at least not yet)

100000-ft Context

Generally, a software application’s core consisted of an interface with user (front-end), logic/tasks (back-end), and some kind of storage for related data (databases), all integrated with each other. Then you would need best practice’s components, such as security (authentication/authorization), or distribution (hosting). Finally, there are specialized components, tailored for distinct use cases (ML, PubSub)

On top of delivering functional requirements of your application, you also needs constant effort to manage physical hardware, scaling, etc. This is where AWS capitalize in: providing managed resources (along with permission gating), allowing you to focus just on application logic.

There are now over 100 types of resources in AWS, some of them have overlap use cases on the surface. This makes it very powerful but also raises the barrier to entry and increase probability of picking the wrong tool for the jobs

Enter Amplify

Amplify encapsulates common use-cases and automatically generates required resources on AWS for you via CloudFormation - a JSON/YAML definition document. Amplify is Front-end agnostic, and will allow any application to interface with its generated back-end infrastructure by exposing a file called aws-exports.json. The core functionality includes

  • Authentication & Authorization: based on Cognito, allow you to do log-in/sign-up and role based access control
  • Storage: file based with S3, similar to having a google drive in your application
  • API: Back-end interface either via REST (API Gateway) or GraphQL (AppSync) which hooks into DynamoDB for document storage. Also can provide add-ons like real-time/offline capabilities
  • Functions: allow stateless and serverless task to be declared and executed whether on-demand or scheduled. Backed by Lambda
  • Hosting: Distribute your application to the world via S3 and CloudFront content deliver network

Amplify can also synergize between each of its core functionality. For example, if you setup auth, you can permission gate your other resources such as your functions, API, etc. What makes it even more powerful is for advanced and/or custom use-cases, you can modify the Cloudformation template directly to create/config any AWS resources you wanted.

Amplify is free and open-source. You only pay for AWS Resources you use (most of them also have free tier). They also have SDK for various languages as well

In Practice?

I started using Amplify with my React frontend since 2 years ago and haven't looked back since. Need to add data model? Define Graphql schema and deploy, will have pub/sub included as well. Need to do a quick request to a Google map/calendar? A lambda will do the trick. Keeping track of your presence online? API Gateway —> SQS —> SNS.

For those who are interested, check out how it structure in VietTech webapp GitHub (https://github.com/bdatdo0601/project-chiron), or checkout its starter doc (https://docs.amplify.aws/start/). Try it for your next project 😅