0
0
AWScloud~30 mins

API deployment and stages in AWS - Mini Project: Build & Apply

Choose your learning style9 modes available
API deployment and stages
📖 Scenario: You are working as a cloud engineer for a company that wants to deploy a simple API using AWS API Gateway. The company needs to create an API, deploy it, and manage different stages like dev and prod to separate development and production environments.
🎯 Goal: Build an AWS API Gateway REST API, deploy it, and create two stages named dev and prod. This will allow the company to manage different versions of the API for testing and production.
📋 What You'll Learn
Create a REST API named SimpleAPI
Deploy the API to a deployment resource
Create two stages named dev and prod
Associate the deployment with both stages
💡 Why This Matters
🌍 Real World
Companies use API Gateway stages to separate development, testing, and production environments for their APIs. This helps manage different versions and safely deploy changes.
💼 Career
Cloud engineers and DevOps professionals often create and manage API Gateway deployments and stages to ensure reliable and organized API lifecycle management.
Progress0 / 4 steps
1
Create the REST API resource
Create a resource called SimpleAPI using AWS CloudFormation syntax with the type AWS::ApiGateway::RestApi. Set the Name property exactly to SimpleAPI.
AWS
Need a hint?

Use AWS::ApiGateway::RestApi as the resource type and set the Name property to SimpleAPI.

2
Create the deployment resource
Add a resource called SimpleAPIDeployment of type AWS::ApiGateway::Deployment. Set the RestApiId property to reference SimpleAPI using !Ref SimpleAPI. Do not set the StageName property here.
AWS
Need a hint?

Use AWS::ApiGateway::Deployment and reference the API with !Ref SimpleAPI.

3
Create the dev and prod stages
Add two resources: DevStage and ProdStage, both of type AWS::ApiGateway::Stage. For each stage, set StageName to dev and prod respectively. Set DeploymentId to reference SimpleAPIDeployment using !Ref SimpleAPIDeployment. Also set RestApiId to reference SimpleAPI using !Ref SimpleAPI.
AWS
Need a hint?

Create two AWS::ApiGateway::Stage resources with StageName set to dev and prod. Reference the deployment and API with !Ref.

4
Add description to the deployment
Add a Description property to the SimpleAPIDeployment resource with the exact value Initial deployment of SimpleAPI.
AWS
Need a hint?

Add the Description property inside the SimpleAPIDeployment Properties section.