When configuring a SAM template and defining a AWS::Serverless::Function
there is the Events param that accepts an Api type. Does this create an API Gateway resource? What is the difference between this event type and a standalone AWS::Serverless::Api
resource?
相关问题
- How to generate 12 digit unique number in redshift
- Use awslogs with kubernetes 'natively'
- Assume/switch role in aws toolkit for eclipse 2.0
- 'no SavedModel bundles found!' on tensorfl
- Installing Python dependencies in AWS Codestar wit
相关文章
- Right way to deploy Rails + Puma + Postgres app to
- how many objects are returned by aws s3api list-ob
- AWS S3 in rails - how to set the s3_signature_vers
- Passthrough input to output in AWS Step Functions
- I cannot locate production log files on Elastic Be
- ImportError: cannot import name 'joblib' f
- Static IP for Auto Scale in AWS
- Step function exceeding the maximum number of char
Taken from the documentation:
The question asks about the APIs referred to in the Event source block of a SAM AWS::Serverless::Function type, such as:
As mentioned in the docs in various places, these are called "implicit APIs" in SAM.
SAM creates resources of type AWS::Serverless::Api from the union of Api events defined on AWS::Serverless::Function resources - but only those that do not refer (via the RestApiId property) to AWS::Serverless::Api defined explicitly in the template.
Behind the scenes, SAM collects all of these implicit APIs, generates a Swagger, and creates the implicit APIs using this Swagger. This API defaults to a StageName called "Prod" which cannot be configured.
If you do need control over defining and documenting the API in Swagger, an AWS::Serverless::Api resource should be created explicitly. It would then be referred to this way:
So the only difference between them is how much control you have over their configuration, and the key consideration is whether or not you need to define either:
If you need control over either or both of these, then you need to define your API explicitly. Otherwise, you can probably use the implicit APIs.
Note also that AWS::Serverless::Api resources in SAM are "transformed" into CloudFormation resources of type AWS::ApiGateway::RestApi, AWS::ApiGateway::Stage, and AWS::ApiGateway::Deployment.
Note that this information is a summary of information found in these three source docs: