Accessing AWS DynamoDB through Apollo GraphQL Server deployed in AWS Lambda through Serverless. Objective: Fetch all records of a DynamoDB table through a GraphQL lambda function. Technologies used: AWS DynamoDB, AWS Lambda, AWS IAM, Serverless, Apollo Graphql.
Objective: Fetch all records of a DynamoDB table through a GraphQL lambda function.
Query:
query {
quotes {
id
value
source
}
}
Response:
{
"data": {
"quotes": [
{
"id": "q2",
"value": "If you don’t like how things are, change it! You’re not a tree.",
"source": "Jim Rohn"
},
{
"id": "q1",
"value": "Start with the end in mind.",
"source": "Stephen Covey"
}
]
}
}
Technologies used: AWS DynamoDB, AWS Lambda, AWS IAM, Serverless, Apollo Graphql
Prerequisite: Basic knowledge of AWS and Intermediate level knowledge of JavaScript, and Apollo Server.
STEP 1 — Create a DynamoDB table
First, create a table named Quote _in DynamoDB with Primary Key _id.
Create DynamoBD table
Add some entries to the table through C_reate item. You can use the below sample JSON text (instead of the _Tree option on the dropdown)
Serverless Express enables you to easily host Express.js APIs on AWS Lambda and AWS HTTP API. Here is how to get started and deliver a Serverless Express.js based API with a custom domain, free SSL certificate and much more!
This article is in continuation of Deploying an Apollo GraphQL Application As An AWS Lambda Function Through Serverless. Wherein we built a minimalistic application to pull AWS DynamoDB data from a locally hosted Graphql server.
Adding Code to AWS Lambda, Lambda Layers, and Lambda Extensions Using Docker. With Docker, we have three ways to add code to Lambda that isn’t directly part of our Lambda function. Try to AWS Lambda, Lambda Layers, and Lambda Extensions Using Docker.
Serverless Proxy with AWS API Gateway and AWS Lambda. We can communicate between Public and Private instance via a Serverless Proxy thanks to AWS Api Gateway and AWS Lambda. Github Webhook calls a Public API Gateway, API Gateway triggers a Lambda attached to VPC.
Serverless Framework: Use AWS S3 Object Lambda to resize images on the fly. I will show you how to use AWS S3 Object Lambda to resize images on the fly. The Serverless Framework will be used to define the Infrastructure as Code and to simplify the deployment.