How to create an API endpoint to provision a DynamoDB table using AWS AppSync? (Part 1)

Reading Time: 6 minutes

AppSync is an AWS-managed GraphQL layer that is built on the benefits of GraphQL and adds a few more cool features to its web and mobile SDKs. AppSync is the best of GraphQL with less complexity than before, which works out great for Serverless applications.

You can refer to our blog How to create an API endpoint to provision a DynamoDB table using AWS AppSync? (Part 2) to understand and create an API endpoint to provision a DynamoDB table using AWS AppSync. 

In this blog, we will cover:

  • What is AWS AppSync
  • How does it work? 
  • Five reasons you should consider AppSync over API Gateway
  • Use Cases of AWS AppSync
  • Pricing of AWS AppSync
  • Companies using AWS AppSync
  • Hands-On 
  • Conclusion

What is AWS AppSync?

AWS AppSync simplifies the development of GraphQL APIs by securely connecting to data sources such as AWS DynamoDB, Lambda, and others. Caches for better speed, subscriptions for real-time updates, and client-side data storage to keep offline clients in sync are all simple to implement. AWS AppSync scales your GraphQL API execution engine up and down automatically to match API request levels once it’s launched.

Features

Immediate updates across clients and devices: GraphQL Subscriptions in AWS AppSync allow you to designate which parts of your data should be exposed in real-time. Subscriptions in GraphQL are simple statements in the application code that notify the service of what data it should update in real-time.

Simplified Data Access and Querying: Employs GraphQL, a data language that allows client apps to fetch, update, and subscribe to data from servers, simplifying data access and querying. In a GraphQL query, the client specifies how the data is to be structured when it is returned by the server. This makes it possible for the client to query only for the data it needs, in the format that it needs it in. Introspection is a feature of GraphQL that allows new developers on a project to learn about the data accessible without having to know anything about the backend.

Cache your data that doesn’t change frequently for improved performance: The server-side data caching features of AWS AppSync eliminate the need to access data sources directly by storing data in high-speed in-memory managed caches and delivering data with minimal latency. It avoids the operational overhead of operating cache clusters because it is completely managed. Data caching allows developers to design maximum performance for their business needs by allowing them to selectively cache data fields and actions defined in the GraphQL schema with customizable expiration.

Preconfigured access to AWS data sources: AWS AppSync gives client applications the ability to specify data requirements with GraphQL so that only the needed data is fetched, allowing for both server and client filtering. Since AWS AppSync supports AWS Lambda, Amazon DynamoDB, and Amazon Elasticsearch, the GraphQL operations can be simple lookups, complex queries & mappings, full-text searches, fuzzy/keyword searches, or geo lookups.

Enterprise security and fine-grained access control: AWS AppSync allows several levels of data access and authorization depending on the needs of an application. A key may be used to safeguard simple access, and AWS Identity and Access Management can be used to provide more limited permissions using Roles. Additionally, it integrates with Amazon Cognito User Pools for email and password functionality, social providers (Facebook, Google+, and log-in with Amazon), and enterprise federation with SAML. Customers may utilize the Group feature to organize users and roles logically, as well as the OAuth features for application access.

Benefits

Built-in real-time & offline capabilities: With managed GraphQL subscriptions, AWS AppSync can push real-time data updates over WebSockets to millions of clients. It also enables local data access for mobile and web apps when they go offline, as well as data synchronization with customizable conflict resolution when they come back online.

No servers to manage: AWS AppSync offers fully managed GraphQL API setup, administration, and maintenance, with high-availability serverless infrastructure built-in. Using the AWS CLI, terminal, Amplify CLI, or CloudFormation, you can quickly create a GraphQL API. For faultless functioning, use CloudWatch and X-Ray to effortlessly monitor and get insights.

Simple & secure data access: With GraphQL, you can get the correct data from one or more data sources with a single network request. AWS AppSync makes it simple to protect your app data with several concurrent authentication mechanisms and lets you configure security, caching, and fine-grained access control right from your GraphQL schema at the data definition level.

How does it work?

Five reasons you should consider AppSync over API Gateway

  • Request Validation 
  • Scalable  Websockets 
  • Automated API documentation 
  • Integration with DynamoDB/ElasticSearch / RDS 
  • Cognito group-based authorization 

Use Cases of AWS AppSync

Real-time collaboration: Broadcast data from the backend to all connected clients (one-to-many) or amongst clients (many-to-many), similar to a second screen situation where the same data is broadcast to all viewers, who may then respond.

Use Cases of AWS AppSync

Real-Time Chat Application: Conversational mobile or online apps that support several private chat rooms, provide access to discussion history, and queue outgoing messages may be constructed, even while a device is offline.

Real-time loT Dashboard:  Access IoT device data delivered to AWS IoT to create real-time dashboards in a mobile or online application that visualizes telemetry from a connected IoT device, such as a vehicle.

Unified microservices access:  Access and integrate data from various microservices operating in containers in a VPC, using a single interface that includes a REST API endpoint, a GraphQL API endpoint, and more.

Unified data access: With a single request, you may retrieve or edit data from a variety of data sources (SQL, NoSQL, search data, REST endpoints, and serverless backends). GraphQL connections can be used to query and create relationships between data sources.

Use Cases of AWS AppSync

Offline application sync: Using AWS AppSync and Amplify DataStore, an on-device persistent storage engine with built-in support for data versioning and conflict detection and resolution, automatically synchronize data between mobile/web apps and the cloud.

Use Cases of AWS AppSync

Pricing of AWS AppSync

After you sign up for an AWS account, you can use the following monthly consumption levels for free for the first 12 months.

  • 250,000 data modification or query operations
  • 250,000 updates in real-time
  • 600,000 minutes of connectivity

Beyond these limits, you’ll be charged at the advertised rates. After 12 months, the AWS AppSync Free Tier will expire.

Companies using AWS AppSync

Companies using AWS AppSync

Conclusion

In this blog, we have discussed AWS AppSync, its features, benefits, use cases, etc. You can refer to our blog How to create an API endpoint to provision a DynamoDB table using AWS AppSync? (Part 2), to see it in action for a business use case creating a new API endpoint that provisions a DynamoDB table and tests the API via a react application. We will also explore the DynamoDB Dashboard and execute some basic queries to test the functionality of the API in our coming blog. Stay tuned to keep getting all updates about our upcoming new blogs on AWS and relevant technologies.

Meanwhile …

Keep Exploring -> Keep Learning -> Keep Mastering

This blog is part of our effort towards building a knowledgeable and kick-ass tech community. At Workfall, we strive to provide the best tech and pay opportunities to AWS-certified talents. If you’re looking to work with global clients, build kick-ass products while making big bucks doing so, give it a shot at workfall.com/partner today.

Back To Top