Connect Akto with AWS API Gateway (Akto-Hosted Connector)
AWS API Gateway is a fully managed service from AWS that helps developers create, publish, monitor, and secure APIs at scale. With this setup there is nothing to deploy or maintain on your side — Akto hosts and runs the connector, and all you do is enable logging and grant Akto read-only access to it.
There are two ways to do that:
Option 1: Manual setup — you enable logging on your stages yourself, then create the cross-account role. Use this if you want to see and control every change made in your account.
Option 2: Automated setup — a single CloudFormation stack does both.
Either way, you finish by sharing the role ARN with Akto.
Prerequisites
One or more REST APIs deployed in AWS API Gateway.
Permissions to create IAM roles in your AWS account.
The AWS Account ID Akto connects from, and the External ID issued for your account — both provided by your Akto representative.
Do all of this in the AWS region where your APIs are deployed.
Option 1: Manual setup
1.1 Enable API Gateway logging
Repeat this for every stage you want Akto to monitor.
Go to API Gateway in the AWS Console.
Navigate to your API and click on
Stagesfrom the left menu.Scroll down to the
Logs and tracingsection and click onEdit.Set the log level to
Error and info logs, turn onData tracing, and save.
Akto reads these execution logs, which API Gateway writes to a log group named API-Gateway-Execution-Logs_<api-id>/<stage-name>. Access logging is not required.
If this is the first API Gateway in the account to use logging, AWS also needs an account-level CloudWatch role. Check API Gateway > Settings > CloudWatch log role ARN — if it is empty, create a role that API Gateway can assume with the
AmazonAPIGatewayPushToCloudWatchLogsmanaged policy attached, and set its ARN there.
1.2 Create the cross-account role
Use whichever you prefer — both produce the same role.
Using CloudFormation
Download akto-cross-account-role-scoped.yml — click Raw, then save the file.
Go to CloudFormation > Create stack > With new resources (standard).
Choose Upload a template file, select the saved file, and click Next.
Name the stack and fill in the parameters:
AktoAWSAccountId— the AWS Account ID given to you by Akto.ExternalId— the External ID issued to you by Akto.
Click through, acknowledge IAM resource creation, and submit.
On CREATE_COMPLETE, copy the
RoleArnfrom the Outputs tab.
Using the IAM console
Go to IAM > Roles > Create role.
Choose Custom trust policy and paste the following, replacing the two placeholders:
Click Next, then Create policy, select the JSON editor, and paste the following. Replace
<REGION>with the region your APIs run in and<YOUR_ACCOUNT_ID>with your AWS account ID.Name the policy, create it, and attach it to the role.
Name the role
AktoApiGatewayLoggingRole-<region>and create it.Open the role and copy its ARN.
logs:DescribeLogGroupscannot be restricted to a name prefix — AWS evaluates list operations against an empty resource, so a prefix pattern never matches. It only exposes log group names. Reading log contents stays restricted toAPI-Gateway-Execution-Logs*.
1.3 Share the setup details with Akto
Akto sets up the infrastructure that discovers and monitors your APIs. Send your Akto representative the following details:
Role ARN — the
RoleArncopied in step 1.2. Example:arn:aws:iam::123456789012:role/akto/AktoApiGatewayLoggingRole-us-east-2AWS region — the region your APIs run in. Example:
us-east-2
Your AWS account is connected once Akto confirms the setup.
Option 2: Automated setup with CloudFormation
A single stack enables execution logging on your stages, configures the account-level CloudWatch role if one isn't already set, and creates the cross-account role.
Option A: AWS Console
Open akto-cross-account-role.yml, click Raw, and save the file.
Go to CloudFormation in the AWS Console and click Create stack > With new resources (standard).
Choose Upload a template file, select the saved file, and click Next.
Enter a stack name (e.g.
akto-api-gateway-connector) and fill in the parameters:AktoAWSAccountId— the AWS Account ID given to you by Akto.ExternalId— the External ID issued to you by Akto.RestApiIds(optional) — comma-separated REST API IDs to enable logging on. Leave blank to enable logging for all APIs.Version— leave as default.
Click Next, check the box acknowledging IAM resource creation, and click Submit.
Once the stack reaches CREATE_COMPLETE, open the Outputs tab and copy the
RoleArnvalue.
Option B: AWS CLI
Download the template:
Create the stack:
Copy the
RoleArnfrom the outputs:
Share the setup details with Akto
Akto sets up the infrastructure that discovers and monitors your APIs. Send your Akto representative the following details:
Role ARN — the
RoleArncopied above. Example:arn:aws:iam::123456789012:role/akto/AktoApiGatewayLoggingRole-us-east-2AWS region — the region your APIs run in. Example:
us-east-2
Your AWS account is connected once Akto confirms the setup.
Note:
Logging is enabled for REST APIs only. Akto discovers HTTP and WebSocket API specs, but does not monitor their traffic.
If
RestApiIdsis left empty, the stack applies to all REST APIs. Set it to scope the setup to specific APIs.To pick up APIs or stages created later, update the stack with a new
Versionvalue (e.g.1.0.1) — CloudFormation re-runs the setup only when a parameter changes. With the manual setup, enable logging on the new stage yourself.Deleting the stack does not disable logging or remove the CloudWatch role it created.
Get Support for your Akto setup
In-app support: Message us in the Akto dashboard.
Join our Discord channel for community support.
Email: Contact
help@akto.io.Contact us here.
Last updated