Cloud Computing - AWS Lambda

Back to Course

Lesson Description

Lession - #1465 Working with Amazon API

You can create a web API with an HTTP endpoint for your Lambda function by using Amazon API Gateway. API Gateway provides tools for creating and documenting web APIs that route HTTP requests to Lambda functions. You can secure access to your API with authentication and authorization controls. Your APIs can serve traffic over the internet or can be accessible only within your VPC.

Resources in your API define one or more methods, such as GET or POST. Methods have an integration that routes requests to a Lambda function or another integration type. You can define each resource and method individually, or use special resource and method types to match all requests that fit a pattern. A proxy resource catches all paths beneath a resource. The ANY method catches all HTTP methods.

Configure access to Amazon API Gateway

To be suitable to emplace to API Gateway, SwaggerHub needs access to AWS and a secret key with the appropriate permissions

Sign in to the Amazon AWS console at https//aws.amazon.com/console/.

In the top right corner, under your username, click My Security Credentials.

However, then click Services in the AWS header, type iam into the search bar, If you don't see the My Security Credentials menu.

However, select Continue to Security Credentials, If a prompt appears.

On the left, select Users and click Add user.

Create New Users

Enter the user name, for illustration, SwaggerHubUser. For the Access type, select Programmatic access.

Creating a user

Click the image to enlarge it.

Click Next Permissions.

Select Attach existing policies directly and select the check boxes next to the following policies



Click Next Review, also Create user.

Important Note down the Access key ID and Secret access key – this is the only time you see them. You'll need to specify these keys in SwaggerHub.

Push the API to Amazon API Gateway

SwaggerHub pushes your API to Amazon API Gateway( creating the necessary Lambda functions>
every time you save the API inSwaggerHub.However, you'll see an error at the top of the SwaggerHub Editor, If there was a problem with pushing the API to API Gateway.

To see your API in API Gateway Open the Amazon API Gateway console at https//console.aws.amazon.com/apigateway.

In the top right corner, select the region you have pushed to.

Click your API in the APIs list. The API name is the same asinfo.title in your API definition.