Have you been curious about whether or not you should learn AWS Amplify?
I was curious for a very long time and took forever before I decided to jump in. My hesitation came from a few different places:
I was worried that Amplify might be some big magical box that I wouldn't understand.
These "magic boxes" feel fun at first, but as soon as you need to do something that's a little more custom for your needs, you waste a lot of time trying to figure out the workarounds and nuances instead of focusing on the important parts of your apps.
If I had to be honest, I saw quite a bit of feedback around Amplify being only great if you "stay on the path paved before you". At the same time, I saw tons of praise around what can be done with it.
I always believe at the end of the day, you have to try these things out for yourself. What might not work for others might work well for you.
I was worried about costs
There's quite a few nightmare stories out there about AWS bills, there are even consultants that are purely focused on saving you money on your AWS implementations. For my needs, personally, I haven't had to worry about any of that, it's definitely something to consider if you're getting into cloud technology.
AWS Docs
I don't even know where to begin with this one. There is so much documentation for so many services, I find it really hard to accurately look up what I'm trying to do. Trying to figure what you need has been overwhelming to me. I have no idea how anyone learns AWS without talking to people who already know AWS. Fortunately, the Amplify docs are much easier to navigate than everything else. And there's also tons of material from both those working on AWS and the community.
The Real Deal
One of the most pleasing things about working with Amplify is how much time I've saved. There are lots of "nice to haves" that I can see myself getting very attached to over time. I'm going to go over a list of ways that Amplify saves you a massive chunk of time:
Set up, Configuration and extending via CLI
Amplify comes with a CLI that allows you to get up and running relatively quickly. It asks you questions about the services you'd like to use and how. After the initial set up, you can continue using the CLI to extend the capabilities of your app with commands like amplify add
, where you can add Cognito User Pools, Lambda's and DynamoDB tables. It walks you through each aspect of what you're trying to do and even provides templates for Lambda's if you need something to reference.
It writes your APIs for you
It's highly recommended that you use AWS AppSync with your Amplify apps. AppSync allows you to easily create GraphQL APIs that can connect to other services you may be using.
So how is it that you get to skip writing APIs?
It's all within the GraphQL schema. Let's take a look at an example schema from the Amplify Docs:
type Blog @model {
id: ID!
name: String!
posts: [Post] @connection(name: "BlogPosts")
}
type Post @model {
id: ID!
title: String!
blog: Blog @connection(name: "BlogPosts")
comments: [Comment] @connection(name: "PostComments")
}
type Comment @model {
id: ID!
content: String
post: Post @connection(name: "PostComments")
}
This schema defines the different aspects of your API and the relationships between the types. From here, you'd run amplify push
and Amplify would generate a bunch of graphql queries and mutations for you to import on the client side of your app. You can read about this in much more detail here
From the example above, it would make GQL queries like createBlog
, createPost
, and createComment
along with the update and deletion queries as well.
Assuming you configured DynamoDB with your Amplify project, these queries would be managing your database accordingly.
To take things further, you get a helper library for using these queries or mutations. It'll look something like:
import { API } from 'aws-amplify'
import { createBlog } from '../graphql/mutations'
API.graphql({
query: createBlog,
variables: { input: { name: "My New Blog" } }
It works the same way for getting, updating and deleting blog data.
You can effortlessly refactor, add or remove anything from the schema to fit your needs. Changing this API is a matter of updating the GraphQL schema and running amplify push
. This by far is the most valuable thing about Amplify, it's worth investing time and energy into mastering schema design.
If you're curious about extending your API, using other services and handling authentication, you can look at the directives provided here
Helper libraries
The aws-amplify
package is really great for removing the friction from using AWS services.
There are also ui libraries for many different frameworks, like @aws-amplify/ui-react
.
Amplify Admin UI
Let's say you made an app for your client and it's required that the client has to make updates to certain aspects of your database or user groups. Normally, you'd have to build out a whole dashboard just for them to be able to log in and handle things. The Amplify Admin UI is exactly that out of the box. You can invite your client to log in to it and you can customize what they have access to. This is another major time saver, I plan on learning much more about this for my current project.
Conclusion
I'm really happy with my commitment to Amplify. It really allows me to worry less about the nitty gritty details of configuration and setting up so that I can work on the core features of the projects I build. I'm going to be writing more posts about my learnings and how I use Amplify in the future, can't wait to share my journey with y'all!
Top comments (1)
Great honest assessment. Thanks.