paint-brush
7 New things in AWS Amplifyby@ryan_marsh
8,199 reads
8,199 reads

7 New things in AWS Amplify

by Ryan MarshAugust 26th, 2018
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

<em>Edit: Corrected a error about the “amplify codegen” command (via </em><a href="https://medium.com/@RichardT1980" data-anchor-type="2" data-user-id="263d1c65ef41" data-action-value="263d1c65ef41" data-action="show-user-card" data-action-type="hover" target="_blank"><em>Ricardo</em></a><em>)</em>

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - 7 New things in AWS Amplify
Ryan Marsh HackerNoon profile picture

AWS signals a bold direction for Amplify

Edit: Corrected a error about the “amplify codegen” command (via Ricardo)

tl;dr

Amplify is Amazon’s open source library for building and integrating Serverless backends. Upcoming features hint at a very exciting vision for developers.

Backstory

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.

1. Amplify CLI Plugins

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.

2. GraphQL Transforms

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. 🎉

3. Custom Transforms

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! 👏

4. Angular and Ionic Support

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.

5. Visual Studio Code Plugin

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.

6. More UI Components?

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?

7. Amplify in the AWS Console?

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?

Conclusion

The ground is being laid for some exciting improvements to Amplify. Expect some big announcements.

Shameless Plug 🔌

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]