# Cannot access ApiGatewayRestApi in resources

**URL:** https://forum.serverless.com/t/cannot-access-apigatewayrestapi-in-resources/16539
**Category:** Serverless Framework
**Created:** [January 14, 2022, 9:10am UTC](https://forum.serverless.com/t/cannot-access-apigatewayrestapi-in-resources/16539 "2022-01-14T09:10:14Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![feedm3](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/feedm3/32/556_2.png) [@feedm3](https://forum.serverless.com/u/feedm3)
#### Post date: [January 17, 2022, 9:05am UTC](https://forum.serverless.com/t/cannot-access-apigatewayrestapi-in-resources/16539/5 "2022-01-17T09:05:36Z")

</div>

Also got the HTTP API reference resolved.

```auto
resources:
  Resources:
    CloudFrontDistribution:
      Type: AWS::CloudFront::Distribution
      Properties:
        DistributionConfig:
          Origins:
            - Id: ApiGateway
              DomainName:
                Fn::Join:
                  - "."
                  - - Ref: HttpApi
                    - execute-api
                    - Ref: AWS::Region
                    - Ref: AWS::URLSuffix

functions:
  hello:
    handler: handler.hello
    memorySize: 128
    events:
      - httpApi:
          path: /
          method: GET

```

> [@Referencing HttpApi base URL in serverless.yml](http://forum.serverless.com/t/referencing-httpapi-base-url-in-serverless-yml/12683/2):
>
> Serverless Framwork creates an output called “HttpApiUrl” when deploying. I looked in the template update stack that is generated and lifted this CloudFormation code from there. I’m using the JSON format here so you may have to adjust if you’re using yaml. environment: { ImportedValue: { "Fn::Join": [ "", [ "https://", { Ref: "HttpApi", }, ".execute-api.", { Ref: "AWS::Region", }, ".", { …

---

_[View the full topic](https://forum.serverless.com/t/cannot-access-apigatewayrestapi-in-resources/16539)._
