Skip to content

How do I access an API Gateway API from another AWS account?

3 minute read
0

I want to access an Amazon API Gateway API from another AWS account.

Resolution

Identify the AWS account that owns the API Gateway endpoint

Note: If you already know the AWS account that owns the API Gateway endpoint, then skip to the access method that matches your endpoint type.

An API Gateway endpoint URL includes the API ID as the subdomain prefix of the execute-api hostname. For example, in https://abcd1234.execute-api.{region}.amazonaws.com/{stage-name}, abcd1234 is the API ID. Each API ID belongs to one AWS account.

To locate the owner of an API Gateway endpoint, take one of the following actions:

  • Create an AWS Support case from the AWS account that owns the API.
    Note: Make sure that you open the Support case from the AWS account that contains the API ID. Support can't investigate resources or disclose account ownership for API IDs that don't belong to the account that opened the case.
  • Use AWS Organizations or resource tags to search across the accounts in your organization for the API ID. For more information, see Turning on multi-account search.

Access public API endpoints

Access Regional or edge-optimized API Gateway public endpoints directly from the API stage URL. For example, https://abcd1234.execute-api.{region}.amazonaws.com/{stage-name}. You can also use a custom domain name in a public hosted zone to access API Gateway public endpoints.

For more information, see How can I set up a public custom domain name for my API Gateway API?

Access private REST API endpoints

Use an interface VPC endpoint to access private REST API endpoints from your Amazon Virtual Private Cloud (Amazon VPC).

To access a private REST API in another account, edit the resource policy to grant cross-account permissions. You can also use a private custom domain name to associate your VPC endpoint in another account.

For more information, see How do I use an interface VPC endpoint to access an API Gateway private REST API in another account?

Configure IAM authentication for REST APIs

To access an API Gateway API across accounts with IAM authentication, complete the following steps:

  1. Attach an identity-based policy to the IAM entity in the consumer account that grants permissions to invoke the API.
  2. Update the resource policy to explicitly allow access for the AWS Identity and Access Management (IAM) role of the source account, as shown in the following REST API example policy:
    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Effect": "Allow",
                "Principal": {
                    "AWS": [
                        "arn:aws:iam::CONSUMER-ACCOUNT-ID:user/USERNAME",
                        "CONSUMER-ACCOUNT-ID"
                    ]
                },
                "Action": "execute-api:Invoke",
                "Resource": [
                    "arn:aws:execute-api:YOUR-REGION:API-OWNER-ACCOUNT-ID:API-ID/*"
                ]
            }
        ]
    }
    Note: Replace CONSUMER-ACCOUNT-ID with the AWS account ID of the API consumer, USERNAME with the IAM user name, and YOUR-REGION with your AWS Region. Replace API-OWNER-ACCOUNT-ID with the AWS account ID that owns the API and API-ID with the API Gateway API ID.

For more information, see How do I activate IAM authentication for API Gateway REST APIs?

Configure IAM authentication for HTTP APIs

The option to use resource policies to provide IAM authentication for cross-accounts isn't available for API Gateway HTTP APIs.

You can use the sts:AssumeRole API action to assume a role for the HTTP API account. The assumed role provides temporary security credentials that you can use to invoke the HTTP API in another account.

For more information, see How can I provide cross-account IAM authorization for API Gateway HTTP APIs?

Related information

Private REST APIs in API Gateway

Example: Allow roles in another AWS account to use an API

AWS OFFICIALUpdated 2 months ago
1 Comment

This article was reviewed and updated on 2026-09-08.

EXPERT

replied 2 months ago