AWS Amplify is a collection of tools from AWS to help you build applications.
Allow me to set the stage here to try to make that as clear as I know how. I have a friend (true story) who wants to build an app centered around physical training. His wife is a physical trainer, and they think perhaps there is some money to be made. It’s not entirely specced out, but perhaps the app sells access to personalized training programs, offers customized diets, exercise videos, and does the scheduling for one-on-one consultations. Sounds smart to me! Assuming they prove out the idea to some degree, it’s time to put their development skills to work and get to building.
A lot of the needs of an app like this map directly and easily to Amplify. A developer starting to plan might think like this:
- We need to host this somewhere… Amplify has Static Web Hosting. And it’s fully featured with the fancy DX we’re starting to except these days: I connect a Git repo, and it will not only do deployment to CDN-backed global static hosting based on commits, but it will run my CI/CD (e.g. run tests) and give me URLs for previewing feature branches. You do all this with the AWS Amplify Console.
- We need to do user authentication... The whole point here is that users can log in to get access to their stuff. Amplify helps with this (it’s Amazon Cognito built-in), which allows for typical sign-up/sign-in/forgot-password stuff, but also all the social login stuff you would expect. This is an example of what Amplify does: it helps abstract and build out underlying cloud services with minimal code.
- We need data storage… Ideally, it’s managed with GraphQL because my modern front-end really benefits from that (perhaps it’s a React app). Amplify has that. It’s AWS AppSync built-in, which means you can use any type of data store, but get amazing features on top, like the GraphQL endpoints, realtime data syncing, and offline support.
That’s just the basics. All of that is extremely well-covered.
How do we set all this stuff up? This is one of the best parts: there is a CLI to help do everything. For example, about that data storage stuff, how do we get going with that? Once the CLI is installed and we’ve run
amplify init in the project, we do
amplify add api and we’ll be walked through it.
Now for this physical training app, we’ll need some static file storage as well. Maybe all the users have custom avatars, and the videos themselves need protected hosting. Well, we’re in AWS land here, so S3 buckets are a perfect fit. How?
amplify add storage and we’ll be walked through it and of course, there are docs.
Impressive, really. We can build almost this entire thing with Amplify.
The one time we might have to reach out to another service is to handle payments. Stripe is usually the first choice of developers because of their great DX and robust APIs. They are built exactly for apps like this. We’d do our communicating with Stripe APIs over serverless functions. And guess what? We’re in AWS land here, so we have access to Lambdas, the best serverless function provider there is. The trick is that we can have our GraphQL setup, via AppSync, call a Lambda which can communicate with any outside API. Fortunately, there is a detailed walkthrough here from Ramon Postulart.
And here’s another approach from Beez Fedia.
So here’s what I think is important to know:
- Amplify is a helper. AWS offers tons of cloud services. Amplify helps you tie them together and get started using the important ones that you need.
- The static hosting is the foundation for a web project. This is a Jamstack approach. But even that isn’t required, you can, for example, build an iOS app with the tools.
- AWS is the biggest cloud provider in the world and powers many of the world’s biggest websites. You can build a personal project here and typically do it under the free tier, but you’ll never need to worry about scaling. You’re at the right place for scaling.
- There is a lot to explore. If you wake up one day and want to add push notifications or explore something like machine learning, that stuff is there too.
If you’ve read this far, I think this quick high-level video will land better:
- The main resource page
- Nadar Dabit writes a ton about Amplify:
- Egghead: Building AWS AppSync APIs using the AWS Amplify CLI
- Here on CSS-Tricks: Getting into GraphQL with AWS AppSync
- AWS Startups Blog: Building your App from Idea to MVP
- DEV: Full Stack Serverless – Building a Real-time Chat App with GraphQL, CDK, AppSync, and React
- Shawn Wang:
- Dave and I chatted with him recently on ShopTalk
- First Look at AWS Amplify Flutter (Developer Preview)
- Typesafe, Fullstack React & GraphQL with AWS Amplify
You can support CSS-Tricks by being an MVP Supporter.