Create Amazon API Gateway as the entry point for AI service requests.
| Setting | Value |
|---|---|
| API name | ielts-ai-api |
| API type | REST API |
| Endpoint type | Regional |
Endpoints:
| Method | Path | Description |
|---|---|---|
| POST | /writing/evaluate | Submit writing sample |
| POST | /speaking/evaluate | Submit audio recording |
| POST | /flashcards/generate | Generate flashcard |
| POST | /upload/audio | Upload audio |
| POST | /upload/document | Upload document |

For each POST endpoint, configure SQS integration:
Request Mapping Template:
Action=SendMessage&MessageBody=$util.urlEncode($input.body)&QueueUrl=$util.urlEncode('https://sqs.ap-southeast-1.amazonaws.com/{account}/ielts-writing-queue')
* (or specific domain)POST, GET, OPTIONSdevhttps://{api-id}.execute-api.ap-southeast-1.amazonaws.com/dev# Create REST API
API_ID=$(aws apigateway create-rest-api \
--name ielts-ai-api \
--endpoint-configuration types=REGIONAL \
--query 'id' --output text)
# Get root resource
ROOT_ID=$(aws apigateway get-resources \
--rest-api-id $API_ID \
--query 'items[?path==`/`].id' --output text)
# Create /ai resource
AI_RESOURCE=$(aws apigateway create-resource \
--rest-api-id $API_ID \
--parent-id $ROOT_ID \
--path-part ai \
--query 'id' --output text)
# Create /ai/writing-assessment resource
aws apigateway create-resource \
--rest-api-id $API_ID \
--parent-id $AI_RESOURCE \
--path-part writing-assessment
Proceed to SQS Queues.