# AWS Apigateway

> Manages AWS API Gateway REST APIs: creating APIs and resources, deploying to stages, and invoking endpoints via curl. Use when working with api lifecycle, invoke and test or when the user mentions api lifecycle, invoke and test.

- Skill: `opknock/aws-apigateway` (Agent Skill)
- Install (CLI): `npx get-skill add opknock/aws-apigateway`
- Raw SKILL.md: https://api.skillmd.com/api/skills/opknock/aws-apigateway/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: DevOps & Infra
- License: MIT
- Author: OpKnock (https://skillmd.com/u/opknock)
- Updated: 2026-11-23
- Page: https://skillmd.com/skills/opknock/aws-apigateway

---


Manages AWS API Gateway REST APIs: creating APIs and resources, deploying to stages, and invoking endpoints via curl.

## Agentic Workflow: Read -> Reason -> Act (aws-apigateway)

You are **Aws Apigateway** (api/general) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.

### 1. Read — api context for `aws-apigateway`
- Domain: Manages AWS API Gateway REST APIs: creating APIs and resources, deploying to stages, and invoking endpoints via curl.
- **api-lifecycle**: Create REST APIs, resources, methods, and deployments. — `aws apigateway create-rest-api --name my-api`
- **invoke-and-test**: Invoke deployed endpoints and test integration. — `curl -X POST https://abc123xyz.execute-api.us-east-1.amazonaws.com/prod/users -H`
- Check `knowledge` and `prerequisites: aws`

### 2. Reason — think for `aws-apigateway`
- For `api-lifecycle`: Create REST APIs, resources, methods, and deployments. — decide which checks to run
- For `invoke-and-test`: Invoke deployed endpoints and test integration. — decide which checks to run
- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs

### 3. Act — execute with `aws-apigateway` tools
- Tools: `Glob`, `Grep`, `Read`, `Aws`, `Bash` (see frontmatter `tools`/`allowed-tools`)
- Use `safe_path` for any write; record evidence (paths, checksums)
- Fingerprint: `aws-apigateway:4e18f94a`

# AWS API Gateway

## What this skill does

Manages AWS API Gateway REST APIs: creating APIs and resources, adding methods, deploying to stages, and invoking endpoints via curl and test-invoke-method.

## When to use

- Exposing Lambda functions or HTTP backends as managed APIs
- Adding a deployment/stage for a release
- Debugging a 502/500 from an integration

## Real commands

```bash
# Create an API
aws apigateway create-rest-api --name my-api

# List resources to find the root id
aws apigateway get-resources --rest-api-id abc123xyz

# Deploy to a stage
aws apigateway create-deployment --rest-api-id abc123xyz --stage-name prod

# Invoke from the CLI
aws apigateway test-invoke-method --rest-api-id abc123xyz --resource-id res123 --http-method GET --path-with-query-string '/users'

# Invoke from curl
curl -X POST https://abc123xyz.execute-api.us-east-1.amazonaws.com/prod/users -H "Content-Type: application/json" -d '{"name":"alice"}'
```

## Testing

- Use test-invoke-method to debug before deploying
- Check stage variables and logs after deployment

## Best practices

- Deploy to dev/stage/prod stages; never reuse a stage for releases
- Enable access logging and tracing for production stages
- Use usage plans + API keys for client throttling
- Prefer REST API vs HTTP API by feature needs (WAF, custom domains)

## Capabilities

### api-lifecycle
Create REST APIs, resources, methods, and deployments.

**Parameters:**
- `api_name` (string): Name of the REST API
- `stage_name` (string): Deployment stage name
- `region` (string): AWS region

**Commands:**
- `aws apigateway create-rest-api --name my-api`
- `aws apigateway get-rest-apis`
- `aws apigateway get-resources --rest-api-id abc123xyz`
- `aws apigateway create-deployment --rest-api-id abc123xyz --stage-name prod`
- `aws apigateway get-stages --rest-api-id abc123xyz`

**Examples:**
- aws apigateway create-rest-api --name my-api --endpoint-configuration types=REGIONAL
- aws apigateway create-deployment --rest-api-id abc123xyz --stage-name prod --stage-description "v1.2.0"
- aws apigateway get-rest-apis --query 'items[].{id:id,name:name}' --output table

### invoke-and-test
Invoke deployed endpoints and test integration.

**Parameters:**
- `api_id` (string): REST API ID
- `resource_id` (string): Resource ID for the method
- `http_method` (string): GET/POST/PUT/DELETE

**Commands:**
- `curl -X POST https://abc123xyz.execute-api.us-east-1.amazonaws.com/prod/users -H "Content-Type: application/json" -d '{"name":"alice"}'`
- `curl -s https://abc123xyz.execute-api.us-east-1.amazonaws.com/prod/users?limit=10`
- `aws apigateway test-invoke-method --rest-api-id abc123xyz --resource-id res123 --http-method GET --path-with-query-string '/users'`
- `curl -s -o /dev/null -w "%{http_code}\n" https://abc123xyz.execute-api.us-east-1.amazonaws.com/prod/health`

**Examples:**
- curl -X POST https://abc123xyz.execute-api.us-east-1.amazonaws.com/prod/users -H "Content-Type: application/json" -d '{"name":"alice"}'
- aws apigateway test-invoke-method --rest-api-id abc123xyz --resource-id res123 --http-method GET --path-with-query-string '/users?limit=5'
- curl -i https://abc123xyz.execute-api.us-east-1.amazonaws.com/prod/users | head -30

## References
- [API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/)
- [AWS CLI apigateway Reference](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/index.html)
- [API Gateway Best Practices](https://docs.aws.amazon.com/whitepapers/latest/api-gateway-best-practices/)

