Edit: Corrected a error about the “amplify codegen” command (via Ricardo)
Amplify is Amazon’s open source library for building and integrating Serverless backends. Upcoming features hint at a very exciting vision for developers.
If Serverless is the crown atop Amazon Web Services’ strategy, Amplify is shaping up to be the crown jewel. Amplify is an open source library for Serverless development. Amplify makes it easier to build a Serverless backend and integrate it with your front end. Amplify launched last November at re:Invent 2017.
In June of this year I noticed git commits that appeared to be part of a major refactoring. Then, two weeks ago, major new features started to appear. Now that MobileHub docs point to Amplify, it’s pretty clear what’s going on.
Amplify is going to be a key developer relations tool for on-boarding new serverless projects.
Amplify is changing. I list seven of the most exciting new changes below.
If you’re familiar with Serverless Framework you no doubt leverage plugins. AWS SAM currently lacks plugin support. Amplify will not. Amplify plugins will allow you to add commands or extensions. Extensions can affect the majority of the functionality used by Amplify.
This will put Amplify in direct competition with Serverless Framework. Whereas Serverless Framework benefits from a healthy ecosystem of plugins and components, its plugin system also suffers from a leaky abstraction of CloudFormation and the AWS SDK. Thus, many Serverless Framework plugins use the SDK when CloudFormation would be more idempotent. Amplify is heavily CloudFormation focused and provides a nice wrapper around template generation. This will be a win for teams practicing CI/CD.
Wouldn’t it be nice if you could write a GraphQL schema and generate all the necessary resources at the click of a button? If you’re familiar with Ruby on Rails and ActiveRecord this is a no-brainer. AppSync has always had a feature that does this, but it was only useful as a kick-start.
Amplify now has GraphQL transforms. You annotate your schema with directives such as @model or @searchable. For instance @model will create you a DyanmoDB table, @searchable will stream your objects to ElasticSearch.
When you run amplify push it generates your backend resources as a CloudFormation template and provisions them in the cloud. CloudFormation templates mean sane migrations for generated resources.
Running amplify codegen will take your GraphQL schema, along with query documents, and create strongly typed classes (Swift, TypeScript) for apps to use.
The current transforms handle DynamoDB, Authentication, Model Connections (cardinality), ElasticSearch, and Model Versioning.
The function that produces this CloudFormation template is a stand-alone Npm module. This means you can integrate it in your development workflow even if you aren’t using Amplify. 🎉
The Amplify CLI also provides an API for writing your own GraphQL Transforms. For instance, I’m currently exploring a transform that will make CQRS easier. Tagging a GraphQL Type with @CQRS would add the necessary plumbing to your CloudFormation template. This should be exciting! 👏
When Amplify launched the only supported frameworks were React and ReactNative. Angular and Ionic documentation saw their first commits in April of this year. They now get first class treatment in the docs. On the new Amplify site you’ll also find Angular components for Authenticator, Photo Picker, Album, and bot interactions.
Some areas of documentation still skew towards React. An example of this is “Using GraphQL Endpoints”, React Components have a section but Angular is absent. I was only able to find one official sample app for Angular/Ionic, yet React and ReactNative samples abound. Since this is open source and pull requests are welcome, I expect we will see much more for Angular and Ionic devs.
Visual Studio Marketplace page for AWS Amplify VS Code Extension
Released August 3rd, the AWS Amplify VS Code Extension provides a ton of snippets. Manual config of Amplify can be confusing at times. GraphQL query declarations can be lengthy. Having snippets handy for tasks such as these will increase developer ease. In total I counted 246 snippets.
Snippet for Amplify Using Amazon Cognito User Pools
You can check out all 246 snippets here.
Amplify launched with several React and ReactNative UI components. These helped with things like Cognito auth, and rendering lists of images from an S3 bucket. Their recent promotion to the top nav of Amplify’s homepage makes me think there’s more to come.
UI Components get the hero treatment. More to come?
Currently the MobileHub docs point you to Amplify. New Amplify projects do not create a project in MobileHub like aws-mobile CLI did. This leads me to believe either MobileHub will sunset, or Amplify is going to get its own place in the AWS Console.
Why would MobileHub direct you to Amplify?
The ground is being laid for some exciting improvements to Amplify. Expect some big announcements.
My Serverless Kickstart Workshop 🎓 is everything your team needs to get going on AWS and serverless. If your company is considering a move to serverless architecture I’d like to help. 👋😁 You can reach me at [email protected]