Nathan
Nathan

Reputation: 7709

Can I "Ref" and "GetAtt" an implicit defined API in a AWS SAM template?

I have a AWS Serverless Application Model (SAM) template in which I define an API implicit by defining events at the Functions (as described here).

Now I want to use the API Gateway in a CloudFront Distribution. For this I normally would use Ref and Fn::GetAtt to get the attributes of the API. But since it is not explicitly defined, I do not know what to "Ref".

Is there a way? or do I have to define the API explicitly?

Upvotes: 1

Views: 630

Answers (1)

Keeton Hodgson
Keeton Hodgson

Reputation: 497

An implicit API is given the name ServerlessRestApi. I haven't yet tried to use !Ref or !GetAtt with the implicit API resource, but I would assume that it would be possible as it works with other generated resources.

Here is a link to the GitHub docs that discuss the implicit API resources: https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api

Upvotes: 3

Related Questions