user1506269
user1506269

Reputation:

How to output resource path from serverless framework on aws?

How do I output the resource path/URL to cloudformation Outputs?

For example, I have a lambda that's listening for a http event on path /hello and I'd like the cloudformation to output a variable with the value https://kjkjwerwer.execute-api.eu-west-1.amazonaws.com/test/hello

By default serverless framework outputs the ServiceEndpoint, however, I wanted the full endpoint of each of my functions

Upvotes: 0

Views: 1155

Answers (1)

Aaron Stuyvenberg
Aaron Stuyvenberg

Reputation: 3787

You can output anything you'd like in the resources section. You can use all the same templating variables like !Ref, ${self:custom.myEndpointName}, and !Join to clean it up:

resources:
  Outputs:
    MyEndpointName:
      Description: HTTP Endpoint for MyEndpoint lambda
      Value: ${self:custom.myEndpointName} // Or some other templated/hardcoded string

Upvotes: 1

Related Questions