Answers: <p>Did you try the variable <code>ServerlessRestApi</code>? It works for us like this:</p>
  
  <pre><code>Outputs:    
      EncryptURL:
        Description: "Encrypt endpoint URL for Stage environment"
        Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Stage/encrypt"
  </code></pre>
  
Answers: CC BY-SA 4.0
Answers: 2018-10-13T14:43:48.507Z
Answers: Hey thanks. Yep! That was it! I had to reference the actual RestApi resource. I was referencing the method resource.
Answers: Dr. Chocolate
Answers: CC BY-SA 4.0
Answers: 2018-10-13T16:58:56.123Z
Answers: @mutant_city Cool!
Answers: Niklas Rosencrantz
Answers: CC BY-SA 4.0
Answers: 2018-10-12T06:02:12.943Z
Answers: 2018-10-12T06:02:12.943Z
Answers: Niklas Rosencrantz
Body: <p><a href="https://u1i7vf9mnl.execute-api.us-west-1.amazonaws.com/v1" rel="nofollow noreferrer">https://u1i7vf9mnl.execute-api.us-west-1.amazonaws.com/v1</a></p>
  
  <p>How can I get the u1i7vf9mnl portion of the URL from inside of the cloudformation template as a Ref or Fn::GetAtt or some other way?</p>
  
Tags: <api><aws-cloudformation>
Title: How can I get the first part of the API Deployment URL from inside cloud formation template?
UserDisplayName: Dr. Chocolate
ThreadText: # How can I get the first part of the API Deployment URL from inside cloud formation template?
  
  (Asked by: username_0 on 2018-10-03)
  
  <https://u1i7vf9mnl.execute-api.us-west-1.amazonaws.com/v1>
  
  How can I get the u1i7vf9mnl portion of the URL from inside of the cloudformation template as a Ref or Fn::GetAtt or some other way?
  
  **Tags:** api, aws-cloudformation
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-10-12. Score: 2 | Accepted answer
  
  Did you try the variable `ServerlessRestApi`? It works for us like this:
  
  ```
  Outputs:    
      EncryptURL:
        Description: "Encrypt endpoint URL for Stage environment"
        Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Stage/encrypt"
  
  ```
  
  > **Comments:**
  > **username_0**: Hey thanks. Yep! That was it! I had to reference the actual RestApi resource. I was referencing the method resource.  
  > **username_1**: @mutant_city Cool!  
  
  ---
  
  