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:
Other Resources
- The main resource page
- Nadar Dabit writes a ton about Amplify:
- Shawn Wang:
Thank you! What about privacy (and GDPR compliance)? That is a problem with many third party services and an increasing issue for developers. Does Amplify make that clear and easy?
Nice Post.
Does anyone know if you launch an Amplify stack from a script? I’d like to give each new customer a backend complete with API. In other words is there a way around using the CLI?
I was among the first users to jump on the Amplify train close to 2 years ago. I used it to build most of my web app (link in bio) with: auth using Cognito, functions using lambdas (incl. lambda layers), storage using s3, CI/deployment using amplify console, and APIs using CloudFront.
The good things:
– access to the power and depth of AWS but with a much easier learning curve
– very neat way of managing dev / staging / prod environments and merging changes a la git
– tons of new features all the time
– right mix of easy to use / powerful
Now even with all these awesome features, I still don’t recommend it. I was lured by the promise of “AWS with the simplicity of Firebase”, but what I’ve experienced is nowhere close to this.
Amplify is simply not production ready. New releases often break stuff, and not in a fun “oh it’s just a bit rough around the edges” kind of way.
To give you an example, I added Google sign-in so that users would have an easier time creating accounts. This required updating my cognito user pool, which I did in my staging environment. Upon doing so, I realized that it had deleted every user account, because I had made “deep changes” (for lack of a better term) which had the side effect of reseting the pool.
The reason why it behaved this way, is that since the cli was buggy and couldn’t handle the “update” properly, it somehow messed up the cloudfront files, leading to that reset when I pushed them.
Had I not caught that in staging, I would have pushed live (with no warnings from the amplify CLI mind you), and deleted the account of my 2k users.
In a similar vein, I had to stop using the console build feature, since it wasn’t compatible with google auth apparently. In the GitHub forums, there are tons of “fixes” and “workarounds”, but they often involve reseting the entire environment (including users, live website, etc).
When you run an actual business, and not just a fun side project, having the amplify team reply with “reset everything and it will work” isn’t encouraging. Sadly, it’s this way with multiple major issues, just look at the GitHub board to get an idea.
Over time I’ve learned one thing with Amplify: if it starts acting out, don’t insist on trying to fix it for too long. Else you might break something beyond any hope of soft recovery.
To be fair, it’s getting better and I believe that it will get there someday. There a lot of great things about it. But this just isn’t reliable enough to run a business on. Use it for fun and side projects only.