Understanding serverless.yml file, properties with simple explanation, variables in serverless.yml – Serverless Framework and aws
AWS , Cloud , Uncategorized / April 23, 2020

Serverles.yml Property Description service Will have the properties which describe the service for which the YAML file is for, properties like name, arn… app Name of the app you create service for. App should be created in serverless and name can be found in serverless.com dashboard org Multiple organizations can be created in serverless and this property indicates the organization for which the service is created package Include/Exclude files or folders in the deployment package. Example,to exclude git folder,node_modules.. provider This Will have the properties for the cloud service provider. Details like name(eg:AWS),runtime(eg:Node.js), region(eg:Ohio),and others like timeout,stage(dev,prod..) and memory custom Will have custom variables for services like base, params, role… functions Will have functions in the service. Functions can have name, handler, environment variables, description… resources We will have the resources used by the service, like DynamoDB tables, lambda… output Variable for refactoring. It can be used in other serverless.yml files. This Can be used along with different app/stage/region.Example: ${output:appname:stagename:regionname:my-service.var-key}         Variables in Serverless Variables can be used in YAML file in different ways, the orange highlighted text indicates the various  ways Variables are added using interpolation, variable values are referenced using ${}.     ${self:provider.stage} –…

AppSync/GraphQL : Pagination on DynamoDB data: Curser based pagination
AWS , Cloud , Uncategorized / April 14, 2020

What is AppSync? AWS AppSync helps you create a flexible API to securely access, manipulate, and combine data from one or more data sources.AppSync uses GraphQL. AppSync can be used along with Amazon services like Lambda, DynamoDB, etc.. What is GraphQL? GraphQL is a language for APIs that enables you to query and manipulate data easily through an intuitive and flexible syntax. GraphQL provides a syntax to describe data requirements and interactions, allowing you to ask for exactly what you need and get back predictable results. This article aims at providing strategy on how to query data in the DynamoDB table with sorting and pagination. The pagination strategy used is called cursor-based pagination. Curser based pagination helps to avoid the problems of limit-offset pagination. Shifting of data on insertion and on deletion occurs while paginating in a limit-offset way, this is not ideal for real-time data. Whats is curser based pagination? Cursor-based pagination works using a pointer to a specific item in the dataset. By using this strategy major pitfalls of limit-offset pagination can be avoided.     Achieving pagination on DynamoDB data with AppSync/GraphQL Consider a case where we have an Entity Employees and each employee has multiple  Tasks. It’s a…

AWS: Create an Lambda function that returns a Presigned URL to upload an image to a S3 bucket,Node.js
AWS , Node.js , Cloud , Uncategorized / April 7, 2020

This tutorial aims at providing basic steps required to create a Lambda which will provide a Presigned URL that can be used to upload an object to the AWS S3 bucket. Upload is tested here with Postman. What is s3 ? Amazon S3 or Amazon Simple Storage Service is a service offered by Amazon Web Services that provides object storage. An object consists of a file and optionally any metadata that describes that file. S3 helps to store the objects in buckets, which are more or less like file folders.   What is  presigned URL for s3? A presigned URL gives you access to the object identified in the URL, provided that the creator of the presigned URL has permissions to access that object. That is, if you receive a presigned URL to upload an object, you can upload the object only if the creator of the presigned URL has the necessary permissions to upload that object.   What is ARN? Amazon Resource Names (ARNs)  are identifiers used to uniquely identify AWS resources       Step 1: Create a bucket to store image. Go to services->s3->create bucket Give a name like fortestinglambda Provide public access to the bucket for now and leave…

Create a Lambda and modify and deploy it using cloud9 IDE, work with npm and add Node.js packages to Lambda – Beginner’s guide
AWS , Cloud , Uncategorized / April 1, 2020

In this tutorial, we will learn to  Create an AWS Lambda function with Node.js as the Runtime environment. Import the function into AWS Cloud9(Cloud9 IDE is an Online IDE). Initialize npm, add dependency moment.js and deploy it.   Step 1 – Create a Lambda. Goto services->Lambda and click Create function Choose Author from scratch, Node.js as Runtime, provide a function name and click Create function

The above code will be provided by default. By default, the aws-sdk is available in Lambda functions and you can import it using

        Step 1 – Create an environment and  Import lambda into cloud9 IDE Cloud9 is a AWS online IDE provided by AWS. To access cloud9 move to services->Cloud9.Click on the Create environment button, provide name and description, choose default options and click on the Create environment button.   The IDE interface will look like this.   To import the Lambda function, move to AWS resource and import your remote function.               Step3 – Install Node.js dependency, moment.js. To install Node.js dependency, terminal access is required. To access terminal, go to window->New terminal and access your function folder using 

Do npm…

Share this page in social media platforms