简体   繁体   中英

how to write a shell script for creating an API gateway in AWS

我已经使用 UI 在 AWS 中创建了一个 API 网关,我想自动化这个过程并编写一个 shell 脚本来创建 API 网关,就像我在 AWS 中配置它一样。

As already suggested, I also recommend using better tools such as cloudformation to manage the infrastructure.

If you really want to use bash script, you can use AWS Cli commands in your bash script.

create API

aws apigateway create-rest-api --name my-api

get root resource

API=bs8fqo6bp0 aws apigateway get-resources --rest-api-id $API

create resource

aws apigateway create-resource --rest-api-id $API --path-part test \\ --parent-id e8kitthgdb

here is an example from AWS docs, https://docs.aws.amazon.com/lambda/latest/dg/with-on-demand-https-example.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM