SAMで作成されるApiGatewayをエッジ最適化以外で作成したいとき
2269 ワード
SAMだとApiGatewayのリソースを書かなくても暗黙的につくられますが、既定ではエッジ最適化でつくられているので、リージョンとかプライベートでつくりたい。
今回はリージョンで指定します。
AWS::Serverless::Api
のリソースを記述して、 EndpointConfiguration
に REGIONAL
を指定します。
AWS::Serverless::Function
のEventsに Type: Api
を作成しますが、その際に RestApiId
を指定して、先ほど作成したAWS::Serverless::Api
リソースを参照するように指定します。
template.yaml
Resources:
ApiGatewayApi:
Type: AWS::Serverless::Api
Properties:
StageName: Prod
EndpointConfiguration: REGIONAL
FooFunction:
Type: AWS::Serverless::Function
Properties:
Events:
Foo:
Type: Api
Properties:
Path: /foo
Method: post
RestApiId: !Ref ApiGatewayApi
参考
Author And Source
この問題について(SAMで作成されるApiGatewayをエッジ最適化以外で作成したいとき), 我々は、より多くの情報をここで見つけました https://qiita.com/tinsep19/items/cb84d1bba795ffeb3ceb著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .