0
0
AWScloud~10 mins

REST API creation in AWS - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - REST API creation
Define API Gateway REST API
Create Resources (paths)
Define Methods (GET, POST, etc.)
Integrate Methods with Backend (Lambda, HTTP)
Deploy API to Stage
API is Ready to Receive Requests
This flow shows the steps to create a REST API using AWS API Gateway: define the API, add paths, set methods, connect to backend, deploy, then use.
Execution Sample
AWS
aws apigateway create-rest-api --name MyAPI
aws apigateway create-resource --rest-api-id <id> --parent-id <root> --path-part users
aws apigateway put-method --rest-api-id <id> --resource-id <users> --http-method GET --authorization-type NONE
aws apigateway put-integration --rest-api-id <id> --resource-id <users> --http-method GET --type MOCK
aws apigateway create-deployment --rest-api-id <id> --stage-name prod
This sequence creates a REST API named MyAPI with a /users GET method using a mock integration, then deploys it to the prod stage.
Process Table
StepActionInputResultNotes
1Create REST APIName=MyAPIAPI ID=abc123API created with unique ID
2Create Resourcerest-api-id=abc123, path-part=usersResource ID=res456Resource /users added under root
3Put Methodrest-api-id=abc123, resource-id=res456, method=GETMethod GET createdGET method added to /users
4Put Integrationrest-api-id=abc123, resource-id=res456, method=GET, type=MOCKIntegration setGET method linked to mock backend
5Create Deploymentrest-api-id=abc123, stage=prodDeployment ID=dep789API deployed to prod stage
6Test APIInvoke GET https://abc123.execute-api.region.amazonaws.com/prod/usersResponse 200 OKAPI responds as expected
7ExitN/AEndAPI creation and deployment complete
💡 API is deployed and ready to receive requests at the prod stage
Status Tracker
VariableStartAfter Step 1After Step 2After Step 3After Step 4After Step 5Final
API IDNoneabc123abc123abc123abc123abc123abc123
Resource IDNoneNoneres456res456res456res456res456
Method GETNoneNoneNoneCreatedCreatedCreatedCreated
IntegrationNoneNoneNoneNoneSet to MOCKSet to MOCKSet to MOCK
DeploymentNoneNoneNoneNoneNonedep789dep789
Key Moments - 3 Insights
Why do we need to create a resource before adding a method?
Because methods like GET or POST belong to specific paths (resources). Step 2 creates the /users path, then step 3 adds GET to it.
What does the integration step do?
It connects the method to a backend service. In step 4, the GET method is linked to a MOCK integration, meaning it returns a fixed response.
Why is deployment necessary after creating methods and integrations?
Deployment (step 5) publishes the API configuration to a stage so it becomes accessible. Without deployment, the API changes are not live.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the Resource ID after step 2?
Aabc123
Bres456
Cdep789
DNone
💡 Hint
Check the 'Result' column in row for step 2 in the execution_table.
At which step is the GET method created?
AStep 1
BStep 4
CStep 3
DStep 5
💡 Hint
Look for 'Method GET created' in the execution_table rows.
If we skip the deployment step, what happens when we try to call the API?
AAPI returns an error or is not reachable
BAPI responds with 200 OK
CAPI returns a mock response
DAPI automatically deploys
💡 Hint
Refer to the exit_note and step 5 about deployment necessity.
Concept Snapshot
AWS REST API creation steps:
1. Create API Gateway REST API
2. Add resources (paths)
3. Define methods (GET, POST)
4. Integrate methods with backend (Lambda, MOCK)
5. Deploy API to a stage
6. Use the deployed API endpoint
Deployment is required to make API live.
Full Transcript
To create a REST API in AWS, first define the API Gateway REST API. Then add resources which represent URL paths. Next, define HTTP methods like GET or POST on those resources. After that, integrate these methods with backend services such as Lambda functions or mock responses. Finally, deploy the API to a stage like 'prod' to make it accessible. Without deployment, the API is not live. This process ensures your API is structured, connected, and ready to handle requests.