← 返回命令列表

Linux command

aws-apigateway 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

List all REST APIs

aws apigateway get-rest-apis

Create a new REST API

aws apigateway create-rest-api --name "[MyAPI]" --description "[API description]"

Create a regional API

aws apigateway create-rest-api --name "[MyAPI]" --endpoint-configuration types=REGIONAL

Get API details

aws apigateway get-rest-api --rest-api-id [api-id]

Create a resource

aws apigateway create-resource --rest-api-id [api-id] --parent-id [parent-id] --path-part "[users]"

Create a deployment

aws apigateway create-deployment --rest-api-id [api-id] --stage-name [prod]

Delete a REST API

aws apigateway delete-rest-api --rest-api-id [api-id]

说明

aws apigateway manages Amazon API Gateway REST APIs through the AWS CLI. It creates and configures APIs that act as front doors for applications to access backend services, Lambda functions, or other AWS services. The typical workflow involves creating an API with create-rest-api, defining resources (URL paths) with create-resource, adding HTTP methods with put-method, configuring backend integrations with put-integration, and deploying to a stage with create-deployment. Endpoint types control how the API is accessed: EDGE for CloudFront distribution (global), REGIONAL for same-region access, and PRIVATE for VPC-only access. API keys and usage plans provide access control and throttling. Stages represent different environments (dev, staging, prod) with independent configurations.

参数

create-rest-api
Create a new REST API
get-rest-apis
List all REST APIs in the account
get-rest-api
Get details of a specific REST API
delete-rest-api
Delete a REST API
create-resource
Create a resource (URL path segment) in an API
get-resources
List resources in an API
put-method
Add an HTTP method to a resource
put-integration
Set up backend integration for a method
create-deployment
Deploy an API to a stage
get-stages
List deployment stages
get-api-keys
List API keys
create-api-key
Create a new API key
--rest-api-id _id_
The identifier of the REST API
--name _name_
Name for the API or resource
--description _text_
Description of the API
--endpoint-configuration _config_
Endpoint type: EDGE, REGIONAL, or PRIVATE
--stage-name _name_
Deployment stage name (dev, staging, prod)

FAQ

What is the aws-apigateway command used for?

aws apigateway manages Amazon API Gateway REST APIs through the AWS CLI. It creates and configures APIs that act as front doors for applications to access backend services, Lambda functions, or other AWS services. The typical workflow involves creating an API with create-rest-api, defining resources (URL paths) with create-resource, adding HTTP methods with put-method, configuring backend integrations with put-integration, and deploying to a stage with create-deployment. Endpoint types control how the API is accessed: EDGE for CloudFront distribution (global), REGIONAL for same-region access, and PRIVATE for VPC-only access. API keys and usage plans provide access control and throttling. Stages represent different environments (dev, staging, prod) with independent configurations.

How do I run a basic aws-apigateway example?

Run `aws apigateway get-rest-apis` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does create-rest-api do in aws-apigateway?

Create a new REST API