DEV Community

Roy for BLST

Posted on

How to get started with AWS REST API Gateway

What is AWS REST API Gateway?

API Gateway is a key component of the AWS serverless platform, which enables you to build applications and services that are responsive to events and automatically scale up or down in response to changes in demand. With API Gateway, you can create APIs that access AWS or other web services, as well as data stored in the AWS Cloud.

API Gateway provides two main features:

  • A fully managed service that makes it easy to create, publish, maintain, monitor, and secure APIs at any scale
  • A key component of the AWS serverless platform that enables you to build applications and services that are responsive to events and automatically scale up or down in response to changes in demand

Why use AWS REST API Gateway?

API Gateway is a key component of the AWS Serverless Computing platform, which enables developers to build applications and services without having to provision or manage any servers. With API Gateway, developers can create RESTful APIs that enable real time two way communication applications.

There are many reasons to use API Gateway as your API management solution, including the following:

  • Fully managed service–API Gateway is a fully managed service that takes care of all the tasks involved in accepting and processing API requests, including traffic management, authorization and access control, monitoring, and API version management.
  • Scalability–API Gateway can scale automatically to handle spikes in traffic without requiring any changes to your API configuration.
  • Security–API Gateway provides built in security features such as SSL/TLS termination, authentication (via IAM or Cognito), and authorization (via Amazon Cognito or Lambda).
  • Flexibility–API Gateway supports multiple integration types (such as Lambda, HTTP Proxy) and multiple invocation modes (such as RequestResponse and Event). This allows you to build APIs that are tailored to your specific needs.
  • Monitoring–API Gateway provides built in monitoring features that track API usage and performance metrics. These metrics can be used to troubleshoot performance issues or identify potential security risks.

How to get started with AWS REST API Gateway

You will need to create a new API. To do this, click on the "API" tab and click on the "Create API" button. Fill out the required information and click on the "Create" button. Your API will now be created.

  1. Assuming you have an AWS account and are logged in, the first thing you need to do is navigate to the API Gateway service page. You can find this page by searching for "API Gateway" in the AWS console.
  2. Once you are on the API Gateway service page, click the "Create API" button.
  3. In the "Create API" modal, select the "REST" protocol and give your API a name and description. Then, click the "Create API" button.
  4. Once your API has been created, you will need to create a new resource. To do so, you will need to click on the "Actions" tab and then choose "Create Resource".
  5. After you have done so, you will need to enter a name for your resource and choose a resource path, then you will need to select the "Enable API Gateway CORS" checkbox and then click on the "Create Resource".
  6. Now that you have created your resource, you will need to create a new method. To do this, click on the created resource and then click again on the "Actions" tab and choose "Create Method".
  7. After you have done so, you will see a dropdown menu under your resource, select the "GET" method and confirm.
  8. Assuming you already have a lambda functions in your AWS account, In the "Integration type" choose "Lambda Function" option and click on the "Lambda Function Proxy Integration" checkbox. Then select your desired lambda in "Lambda Function" and click Save.
  9. Once you have created your method, you will need to deploy your API. To do this, click on the "Actions" tab and select "Deploy API" then select a stage from the dropdown menu or create a new one. Click on the "Deploy" button and your API will be deployed.

If you're looking to get started with AWS REST API Gateway, there's no need to be intimidated - it's actually quite simple! Just follow these easy steps and you'll be up and running in no time.
information.

Join the discussion in our Discord channel to chat with the team.
Test your API for free now at BLST!

Top comments (2)

Collapse
 
rickdelpo1 profile image
Rick Delpo

Nice and concise explanation. Also, Lambda needs permission to be invoked by the Gateway. Create an IAM Role and look for the Lambda InvokeFunction. Then add the policy to the role

Collapse
 
roy8 profile image
Roy

Thanks!