deploying-custom-domain-rest-api
Deploys a Regional REST API with a custom domain name, a Lambda backend function, and a request-based Lambda authorizer using AWS CLI.
Skill by awsOfficial
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/aws-deploying-custom-domain-rest-api
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: backend, cloud
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
- Runs as
- Node.js package
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/deploying-custom-domain-rest-api
What's inside
- Skill name
deploying-custom-domain-rest-api- Description
- Deploys a Regional REST API with a custom domain name, a Lambda backend function, and a request-based Lambda authorizer using AWS CLI. Covers ACM certificate provisioning, API Gateway REST API creation, Lambda function deployment, request authorizer setup, custom domain configuration, base path mapping, and Route 53 DNS record creation. Trigger keywords: custom domain, REST API, Lambda, Route 53, API Gateway, regional endpoint, request authorizer, base path mapping.
- License
- Apache-2.0
- Instructions
- 248 lines in SKILL.md · view on GitHub
Before installing
- Ships executable scripts
- Instructions call the network
Files (6)
- SKILL.md
- authorizer.mjs · scripts/
- dns-record.json · scripts/
- example_function.mjs · scripts/
- lambda-trust-policy.json · scripts/
- validate.sh · scripts/
SKILL.md (first lines)
# Custom Domain REST API with Lambda and Request Authorizer
## Overview
This SOP deploys a REST API with a Regional custom domain name, a Lambda backend function, and a request-based Lambda authorizer. It handles ACM certificate provisioning, IAM role creation, Lambda function deployment, API Gateway REST API creation with a custom authorizer, custom domain configuration, base path mapping, and Route 53 DNS setup.
The architecture includes:
- An API Gateway REST API with an endpoint type of REGIONAL
- A request-based Lambda authorizer that validates headers, query string parameters, and stage variables
- A Lambda backend function at `GET /example`
- A custom domain name with TLS 1.2
- A base path mapping connecting the custom domain to the API stage
- A Route 53 A-alias record pointing the custom domain to the API Gateway Regional endpoint
Important: This SOP uses Regional endpoints. If the user requests a private endpoint, inform them that this skill covers Regional endpoints only. Private endpoints require VPC endpoint configuration.
## Parameters
- custom_domain_name (required): Fully qualified domain name for the API (e.g., `api.example.com`)
- region (required): AWS Region for all resources. The ACM certificate must be in this same Region for Regional endpoints
- hosted_zone_id (required): Route 53 hosted zone ID for the domain
- acm_certificate_arn (optional): ARN of an existing ACM certificate covering the custom domain. If not provided, Step 2 creates one
- stage_name (optional, default: "dev"): API Gateway stage name
Constraints for parameter acquisition:
- You MUST ask for all required parameters upfront in a single prompt rather than one at a time
- You MUST support multiple input methods (direct input, file path, URL)
- You MUST confirm successful acquisition of all parameters before proceeding
- You MUST inform the user that this skill uses hardcoded demo authorization values (headerValue1, queryValue1, stageValue1) that are NOT suitable for production. For production, use AWS Secrets Manager or Systems Manager Parameter Store to manage authorization credentials. See: https://docs.aws.amazon.com/secretsmanager/latest/userguide/intro.html
- You MUST validate that custom_domain_name is a valid FQDN
## Steps
### 0. Verify Dependencies
Constraints:
- You MUST verify the following tools are available: aws-cli, python3, sed, node (v22+)
- You MUST inform the user about any missing tools with a clear message
- You MUST ask if the user wants to proceed despite missing tools
- You MUST respect the customer's decision to abort at any point
- You MUST explain to the customer what step is being executed, why, and which tool is being called
### 1. Retrieve AWS Account ID
This step MUST be performed before all other steps.
Constraints:
- You MUST retrieve the account ID with: `aws sts get-caller-identity --query 'Account' --output text`
- You MUST store the result as {account_id} and reuse it in all subsequent steps that reference {account_id}
- You MUST abort if credentials are not configured
### 2. Request ACM Certificate
Skip this step if acm_certificate_arn is already provided.
Constraints:
- You MUST request the certificate with: `aws acm request-certificate --domain-name {custom_domain_name} --validation-method DNS --region {region}`
- You MUST capture the CertificateArn from the response
- You MUST retrieve the DNS validation record with: `aws acm describe-certificate --certificate-arn {cert_arn} --query 'Certificate.DomainValidationOptions[0].ResourceRecord' --region {region}`
- You MUST create the validation CNAME in Route 53 with: `aws route53 change-resource-record-sets --hosted-zone-id {hosted_zone_id} --change-batch '{"Changes":[{"Action":"UPSERT","ResourceRecordSet":{"Name":"{validation_name}","Type":"CNAME","TTL":300,"ResourceRecords":[{"Value":"{validation_value}"}]}}]}'`
- You MUST wait for certificate validation with: `aws acm wait certificate-validated --certificate-arn {cert_arn} --region {region}`
- The wait command may take up to 30 minutes. If it times out, check status manually with: `aws acm describe-certificate --certificate-arn {cert_arn} --query 'Certificate.Status' --region {region}` and retry the wait if status is still PENDING_VALIDATION
- You MUST NOT proceed until the certificate status is ISSUED
- You MUST store the certificate ARN as acm_certificate_arn for use in Step 7
### 3. Create IAM Execution Roles
Constraints:
- You MUST create two IAM roles: one for the authorizer Lambda and one for the example function Lambda
- Both roles use the same trust policy from `scripts/lambda-trust-policy.json`. The trust policy includes an `aws:SourceAccount` condition scoped to the user's account ID
- You MUST create a working copy of the trust policy and replace the `ACCOUNT_ID` placeholder with the actual account ID from Step 1. Use: `sed 's/ACCOUNT_ID/{account_id}/' scripts/lambda-trust-policy.json > /tmp/lambda-trust-policy.json`
- You MUST create the authorizer role with: `aws iam create-role --role-name request-authorizer-role --assume-role-policy-document file:///tmp/lambda-trust-policy.json`
- You MUST attach the basic execution policy to the authorizer role with: `aws iam attach-role-policy --role-name request-authorizer-role --policy-arn arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole`
- You MUST create the example function role with: `aws iam create-role --role-name example-function-role --assume-role-policy-document file:///tmp/lambda-trust-policy.json`
- You MUST attach the basic execution policy to the example function role with: `aws iam attach-role-policy --role-name example-function-role --policy-arn arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole`
- You MUST capture the role ARNs from each create-role response for use in Step 4
- You MUST wait at least 10 seconds after role creation before creating Lambda functions because IAM role propagation is eventually consistent
### 4. Create and Deploy Lambda Functions
Constraints:
- You MUST create two Lambda functions: the request authorizer and the example function
- For the authorizer function:
- You MUST create the function with inline code. First write the code to a file and package it:
`python3 -c "import zipfile,io,base64; z=io.BytesIO(); f=zipfile.ZipFile(z,'w'); f.writestr('index.mjs', open('scripts/authorizer.mjs').read()); f.close(); open('/tmp/authorizer.zip','wb').write(z.getvalue())"`
- Then create the function with: `aws lambda create-function --function-name request-authorizer --runtime nodejs22.x --handler index.handler --role {authorizer_role_arn} --zip-file fileb:///tmp/authorizer.zip --timeout 10 --region {region}`
- For the example function:
- You MUST create the function with inline code. First write the code to a file and package it:
`python3 -c "import zipfile,io; z=io.BytesIO(); f=zipfile.ZipFile(z,'w'); f.writestr('index.mjs', open('scripts/example_function.mjs').read()); f.close(); open('/tmp/example_function.zip','wb').write(z.getvalue())"`
- Then create the function with: `aws lambda create-function --function-name example-function --runtime nodejs22.x --handler index.handler --role {example_role_arn} --zip-file fileb:///tmp/example_function.zip --timeout 10 --region {region}`
- You MUST verify each function was created by calling: `aws lambda get-function --function-name {function_name} --region {region}`
### 5. Create REST API with Request Authorizer
Constraints:
- You MUST create the REST API with: `aws apigateway create-rest-api --name custom-domain-api --endpoint-configuration types=REGIONAL --region {region}`
- You MUST capture the API id and get the root resource ID with: `aws apigateway get-resources --rest-api-id {api_id} --region {region}`
- You MUST create the request-based Lambda authorizer with: `aws apigateway create-authorizer --rest-api-id {api_id} --name request-authorizer --type REQUEST --authorizer-uri 'arn:aws:apigateway:{region}:lambda:path/2015-03-31/functions/arn:aws:lambda:{region}:{account_id}:function:request-authorizer/invocations' --identity-source 'method.request.header.HeaderAuth1,method.request.querystring.QueryString1,context.stage' --region {region}`
- You MUST capture the authorizer ID from the response
- You MUST grant API Gateway permission to invoke the authorizer with: `aws lambda add-permission --function-name request-authorizer --statement-id apigateway-auth-invoke --action lambda:InvokeFunction --principal apigateway.amazonaws.com --source-arn 'arn:aws:execute-api:{region}:{account_id}:{api_id}/authorizers/{authorizer_id}' --region {region}`
- You MUST create the /example resource with: `aws apigateway create-resource --rest-api-id {api_id} --parent-id {root_resource_id} --path-part example --region {region}`
- You MUST create the GET method with: `aws apigateway put-method --rest-api-id {api_id} --resource-id {example_resource_id} --http-method GET --authorization-type CUSTOM --authorizer-id {authorizer_id} --region {region}`
- You MUST create the Lambda proxy integration with: `aws apigateway put-integration --rest-api-id {api_id} --resource-id {example_resource_id} --http-method GET --type AWS_PROXY --integration-http-method POST --uri 'arn:aws:apigateway:{region}:lambda:path/2015-03-31/functions/arn:aws:lambda:{region}:{account_id}:function:example-function/invocations' --region {region}`
- You MUST grant API Gateway permission to invoke the example function with: `aws lambda add-permission --function-name example-function --statement-id apigateway-invoke --action lambda:InvokeFunction --principal apigateway.amazonaws.com --source-arn 'arn:aws:execute-api:{region}:{account_id}:{api_id}/*/GET/example' --region {region}`
- You MUST NOT create the deployment until all resources, methods, and integrations are configured
- You MUST configure request validation to reject malformed query parameters and headers by validating that QueryString1 and HeaderAuth1 match expected patterns and enforcing size limits
### 6. Deploy the API
Constraints:From aws/agent-toolkit-for-aws, Apache-2.0.
More from aws/agent-toolkit-for-aws
- 0.843score
agents-build
aws-agentcoreOfficial
Use to extend an existing agent project with memory, app integration, VPC, multi-agent, migration, model, browser, code interpreter, payments, or resource…
SkillAFreshness: A★ 3KClaude Code +9 - 0.782score
agents-pay
aws-agentcoreOfficial
Use when THIS agent needs to pay for x402-protected content at runtime: hitting a paywall mid-task, settling it via AgentCore Payments, and applying…
SkillBFreshness: B★ 3KClaude Code +9 - 0.739score
agents-optimize
aws-agentcoreOfficial
Use when measuring or improving agent quality and performance — set up evaluators, online monitoring, CI/CD quality gates, observability, or cost optimization.
SkillCFreshness: C★ 3KClaude Code +9 - 0.739score
agents-deploy
aws-agentcoreOfficial
Use when deploying your agent to AWS, or when a deploy has failed.
SkillCFreshness: C★ 3KClaude Code +9 - 0.734score
agents-get-started
aws-agentcoreOfficial
Use when a developer wants to create a new agent project or get started with AgentCore.
SkillCFreshness: C★ 3KClaude Code +9 - 0.724score
aws-transform
AWSOfficial
Performs code upgrades, migrations, and transformations using the AWS Transform (ATX) CLI.
SkillCFreshness: C★ 3KClaude Code +9 - 0.724score
agents-debug
aws-agentcoreOfficial
Use when your agent or environment is broken — wrong answers, errors, timeouts, tool failures, or CLI issues.
SkillCFreshness: C★ 3KClaude Code +9 - 0.724score
agents-harden
aws-agentcoreOfficial
Use when preparing your agent for production — IAM scoping, inbound auth (JWT, SigV4), secrets management, cold start optimization, session lifecycle, rate…
SkillCFreshness: C★ 3KClaude Code +9 - 0.700score
agents-connect
aws-agentcoreOfficial
Use when connecting your agent to external APIs, tools, or services via Gateway, or restricting tool access with Cedar policies.
SkillCFreshness: C★ 3KClaude Code +9 - 0.682score
knowledge-base-for-startups
awsOfficial
AWS Startups reference content — Activate FAQ, credits guide, programs, partner offers, sample architectures, and hundreds of learn articles spanning…
SkillAFreshness: A★ 3KClaude Code +9 - 0.682score
aws-sms-voice
awsOfficial
Onboards RCS Business Messaging and Notify OTP via the pinpoint-sms-voice-v2 AWS CLI.
SkillAFreshness: A★ 3KClaude Code +9 - 0.682score
agent-advisor
awsOfficial
Entry point for AI-agent work on AWS: pick a runtime, plan a migration for existing workloads, and build an executable POC — one phased flow.
SkillAFreshness: A★ 3KClaude Code +9
Signals
- Stars
- 3,049
- Forks
- 394
- Open issues
- 40
- Last commit (this folder)
- Jun 18, 2026 (4 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- Apache-2.0
- Repository
- github.com/aws/agent-toolkit-for-aws
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from aws
- 0.781score
AWS MCP Server
awsOfficial
A managed MCP server enabling AI agents to access AWS using docs, API calls, and SOP workflows.
ConnectorBFreshness: BLocal↓ 416.2K/wkClaude Code +5 - 0.781score
AWS MCP Server
awsOfficial
AWS MCP Server lets AI securely access AWS using docs, API calls, and SOP workflows.
ConnectorBFreshness: BLocal↓ 416.2K/wkClaude Code +5 - 0.682score
agent-advisor
awsOfficial
Entry point for AI-agent work on AWS: pick a runtime, plan a migration for existing workloads, and build an executable POC — one phased flow.
SkillAFreshness: A★ 3KClaude Code +9 - 0.682score
prompt-library-for-startups
awsOfficial
AWS-curated copy-paste prompts for AI coding agents (MVP scaffolding, RAG chatbot with Claude on Bedrock, security baseline evaluation, cost anomaly…
SkillAFreshness: A★ 3KClaude Code +9 - 0.682score
knowledge-base-for-startups
awsOfficial
AWS Startups reference content — Activate FAQ, credits guide, programs, partner offers, sample architectures, and hundreds of learn articles spanning…
SkillAFreshness: A★ 3KClaude Code +9 - 0.682score
aws-sms-voice
awsOfficial
Onboards RCS Business Messaging and Notify OTP via the pinpoint-sms-voice-v2 AWS CLI.
SkillAFreshness: A★ 3KClaude Code +9
Cite this page
deploying-custom-domain-rest-api skill. Agent Mart. https://agentmart.dev/skills/aws-deploying-custom-domain-rest-api (last updated 2026-10-24)