Latest news about Bitcoin and all cryptocurrencies. Your daily crypto news habit.
Serverless AppSync Plugin: Top 10 New Features
If you are not familiar with AppSync or the plugin yet, we suggest you to read the following posts first:
Part 1: Introduction: GraphQL endpoints with API Gateway + AWS Lambda Part 2: AppSync Backend: AWS Managed GraphQL ServicePart 3: AppSync Frontend: AWS Managed GraphQL ServicePart 4: Serverless AppSync Plugin: New Features (this blog)
Introduction
AWS AppSync is a fully managed serverless GraphQL service for real-time data queries, synchronization, communications, and offline programming features. It is great for building scalable data-driven mobile, web or enterprise applications quickly, and without the hassle of managing complex infrastructures.
Serverless AppSync plugin allows you to develop and test your AppSync GraphQL API locally on your workstation. You can use this plugin as a part of your continuous integration and continuous deployment (CI/CD) framework to deploy your GraphQL API automatically in production.
This plugin is built on the top of the serverless framework and has received a great reception from the open source GraphQL community since its launch last year in 2018. So far, we have released 17+ versions of the plugin which has 450+ stars on GitHub, 65K+ total npm downloads and 45+ contributors have helped to close 100+ open GitHub issues. There is even a youtube video showing it in action. The open source community has been doing a great job over the last few months to improve the features of this plugin, and we have received dozens of pull requests.
In this post, we will outline some of the important features added to this plugin over the past few months…
What is new?
1) AppSync Offline Support
Have you ever dreamt about speeding your AppSync development cycles by testing your AppSync resolvers locally?
Offline support has been a recurring topic of discussion among the AppSync users, and thanks to James and Andreas, your dream has come true! The AppSync Emulator, which is built on top of the AppSync plugin, gives you the flexibility to test and develop the AppSync API in your local environment. Now, you don’t have to deploy your code every time you make a change :)
This plugin extension will even spin up the emulator automatically for you.
Sample code (Reference)
plugins: - serverless-appsync-plugin - serverless-dynamodb-local - serverless-appsync-offline - serverless-offlinecustom: appsync-offline: port: 62222 dynamodb: client: endpoint: "http://localhost:8000" region: localhost
The serverless appsync-offline start command can be triggered automatically when using serverless-offline plugin.
2) Auto-generated roles and policies
Have you ever struggled to create the right IAM roles and policies for your data sources?
Creating, updating and managing IAM policies, statements and actions for the AppSync data sources is not an easy task. On top of that, it usually ends up adding extra boilerplate code to your serverless yaml file. The plugin now fixes this problem by generating IAM roles and policies for you, based on the type of the data source and its target.
For instance, a lambda data source will automatically be assigned a policy that allows it to execute the target lambda function, and a given set of DynamoDB data sources will be authorized to execute all read/write actions on the target table. In addition to that, customizing the policy is now much easier to do with the new iamRoleStatements config.
Sample code:
dataSources: - type: AMAZON_DYNAMODB name: DynamoDBDataSource description: config: tableName: myTable #allow datasource to execute GetItem on "myTable" iamRoleStatements: - Effect: "Allow" Action: - "dynamodb:GetItem" Re
Disclaimer
The views and opinions expressed in this article are solely those of the authors and do not reflect the views of Bitcoin Insider. Every investment and trading move involves risk - this is especially true for cryptocurrencies given their volatility. We strongly advise our readers to conduct their own research when making a decision.