Embracing Serverless with AWS Amplify: Your Step-by-Step Journey to Success

Image

Manish Kumawat

Last Updated on: 19 January 2024

Aws Amplify:

What is Aws Amplify?

Aws Amplify is a set of tools and services that enables applications to be built and deployed for scale.

How to add Api using aws amplify in lambda

Install and configure the Amplify CLI.

fulminous Embracing Serverless blog
Run the following command in your project's root folder:

$> amplify add api

fulminous Embracing Serverless blog

$> ? please select from one of the below mentioned services:

GraphQl

>REST (Select REST as the service type)

fulminous Embracing Serverless blog

$> √ Would you like to add a new path to an existing REST API: (y/N) · no

$> ? Provide a friendly name for your resource to be used as a label for this category in the project: lambdafunction

$> √ Provide a path (e.g., /book/{isbn}): · /book/admin

$> √ Choose a Lambda source : Create a new Lambda function

$> ? Provide the AWS Lambda function name: lambdafunction

$>? Choose the runtime that you want to use: NodeJS

$> ? Choose the function template that you want to use: (Use arrow keys)

❯ Hello world function

fulminous Embracing Serverless blog

Available advanced settings:

  • - Resource access permissions
  • - Scheduled recurring invocation
  • - Lambda layers configuration
  • - Environment variables configuration
  • - Secret values configuration

❯ $> ? Do you want to configure advanced settings? (y/N) Yes

❯ $> ? Do you want to access other resources in this project from your Lambda function? (y/N) Yes

(if you select yes )

fulminous Embracing Serverless blog
❯ $> ? Select the categories you want this function to have access to You can access the following resource attributes as environment variables from your lambda function
  • ENV
  • REGION

❯ $> ? Do you want to invoke this function on a recurring schedule? No

❯ $> ? Do you want to enable Lambda layer for this function ?No

❯ $> ? Do you want to configure environment variable for this function?No

❯$> ? Do you want to configure secret value this function can access?No

❯$> ?Do you want to edit the local lambda function now ? No

Successfully added resource lambdafunction locally.

(if you select No )

fulminous Embracing Serverless blog

❯ $>? Do you want to invoke this function on a recurring schedule? No

❯ $> ? Do you want to enable Lambda layers for this function? No

❯ $> ? Do you want to configure environment variables for this function? Yes

❯ $> ? Enter the environment variable name: clientId

❯ $> ? Enter the environment variable value: test

❯ $> ? Select what you want to do with environment variables: I'm done You can access the following resource attributes as environment variables from your Lambda function

  • ENV
  • REGION
  • clientId

❯ $> ? Do you want to configure secret values this function can access? No

❯ $> ? Do you want to edit the local lambda function now? No

Successfully added resource lambdafunction locally.

After your resources have been created update your backend with the push command:

❯ $> amplify push

fulminous Embracing Serverless blog

Image

Manish Kumawat

IconVerified Expert in Software & Web App Engineering

Manish Kumawat is the co-founder at Fulminous Software. He is an expert at writing about technical stuff in the IT world. Imagine making the most complicated tech things easy to understand - that's what he do. But that's not all. He has developed and honed the company’s vision, corporate structure & initiatives, and its goals, and brought the company into the current era of success.

Let’s discuss your project

Fulminous Software is an elite tech service provider company.

Partner with Top-Notch Web Application Development Company!

Discuss your Custom Application Requirements on info@fulminoussoftware.com or call us on + 1 803 310 5187.

15 Days Risk-Free Trial