0
0
AWScloud~10 mins

API deployment and stages in AWS - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - API deployment and stages
Create API Definition
Deploy API to Stage
Stage Created with URL
Client Calls Stage URL
API Gateway Routes Request
Backend Service Responds
Response Returned to Client
This flow shows how an API is created, deployed to a stage, and then accessed by clients through that stage URL.
Execution Sample
AWS
aws apigateway create-rest-api --name MyAPI
aws apigateway create-deployment --rest-api-id abc123 --stage-name prod
curl https://abc123.execute-api.region.amazonaws.com/prod/resource
Creates an API, deploys it to a 'prod' stage, and calls the deployed API endpoint.
Process Table
StepActionInput/ParametersResult/OutputNotes
1Create APIName=MyAPIAPI ID=abc123API created with unique ID
2Create DeploymentAPI ID=abc123, Stage=prodDeployment ID=dep456, Stage URL=https://abc123.execute-api.region.amazonaws.com/prodAPI deployed to 'prod' stage
3Client CallURL=https://abc123.execute-api.region.amazonaws.com/prod/resourceRequest routed to backend, Response=200 OKClient accesses deployed API
4Update APIAdd new resource or methodAPI definition updatedChanges made but not live until redeployed
5Create New DeploymentAPI ID=abc123, Stage=prodDeployment ID=dep789, Stage URL unchangedNew deployment updates stage with latest API
6Client CallURL=https://abc123.execute-api.region.amazonaws.com/prod/resourceRequest routed to updated backend, Response=200 OKClient accesses updated API
7ExitNo further deploymentsAPI stable at 'prod' stageExecution stops as no new deployments
💡 No new deployments created, API stage remains stable
Status Tracker
VariableStartAfter Step 1After Step 2After Step 4After Step 5Final
API IDNoneabc123abc123abc123abc123abc123
Deployment IDNoneNonedep456dep456dep789dep789
Stage NameNoneNoneprodprodprodprod
Stage URLNoneNonehttps://abc123.execute-api.region.amazonaws.com/prodhttps://abc123.execute-api.region.amazonaws.com/prodhttps://abc123.execute-api.region.amazonaws.com/prodhttps://abc123.execute-api.region.amazonaws.com/prod
API DefinitionEmptyCreatedCreatedUpdatedUpdatedUpdated
Key Moments - 2 Insights
Why does updating the API definition not immediately change the live API?
Because the API must be redeployed to a stage after updates. See step 4 and 5 in the execution_table where the API is updated but only after step 5 deployment does the stage reflect changes.
What is the purpose of stages in API deployment?
Stages provide separate deployment environments (like 'prod' or 'dev') with unique URLs. This lets you test changes in one stage without affecting others. The execution_table shows deployment to 'prod' stage creating a stage URL.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what is the Deployment ID after the first deployment?
Adep456
Babc123
Cdep789
Dprod
💡 Hint
Check the 'Result/Output' column in step 2 of the execution_table.
At which step does the API stage URL become available?
AStep 4
BStep 1
CStep 2
DStep 5
💡 Hint
Look for when the 'Stage URL' is first shown in the execution_table.
If you update the API but do not create a new deployment, what happens when clients call the stage URL?
AThey get the updated API response
BThey get the old API response
CThey get an error
DThe stage URL changes
💡 Hint
Refer to steps 4 and 5 in the execution_table and variable_tracker for API Definition and Deployment ID.
Concept Snapshot
API Deployment and Stages:
- Create API to get API ID
- Deploy API to a stage (e.g., 'prod') to get a stage URL
- Clients call the stage URL to access the API
- Updating API requires redeployment to update the stage
- Stages isolate environments for testing and production
Full Transcript
This visual execution traces the process of deploying an API in AWS API Gateway. First, an API is created and assigned an ID. Then, the API is deployed to a stage, which creates a unique URL for clients to call. Clients use this URL to send requests that API Gateway routes to backend services. When the API definition changes, these changes do not affect the live stage until a new deployment is created. Stages allow separation of environments like development and production. The execution table shows each step, including creating the API, deploying it, client calls, updating the API, and redeploying. Variable tracking shows how API ID, deployment ID, stage name, and URL evolve. Key moments clarify why redeployment is needed and the role of stages. The quiz tests understanding of deployment IDs, stage URL availability, and behavior when redeployment is skipped.