Connect Akto with AWS API Gateway with service account
Last updated
Was this helpful?
Last updated
Was this helpful?
AWS API Gateway is a fully managed service from AWS that helps developers create, publish, monitor, and secure APIs at scale. By integrating AWS API Gateway with Akto, you'll automatically discover and test the security of all your REST APIs, HTTP APIs, and WebSocket APIs deployed through API Gateway, ensuring comprehensive API security across your AWS infrastructure.
To connect Akto with AWS API Gateway using Service Accounts (IRSA), follow these steps:
Follow the steps mentioned here to set up the Akto Traffic Processor.
Go to API Gateway in the AWS Console.
Navigate to your API and click on Stages
from the left menu.
Scroll down to the Logs and tracing
section and click on Edit
.
Select Error and info logs
and Data tracing
and save these settings.
Find out the CloudWatch log group
for your API Gateway for the stage which has the above logs enabled and save it. You'll need it later. (You can find this in the CloudWatch Logs section under the AWS Console.)
If you don’t have an existing EKS cluster, you can create one using the AWS Console:
Go to the Amazon EKS service in the AWS Management Console.
Click on Create Cluster.
Provide a name for your cluster and select the Kubernetes version.
Choose the networking settings (VPC, subnets, security groups).
Select an IAM role for the cluster.
Select an IAM role for the node.
Configure other optional settings and click Create.
Copy the OpenID Connect (OIDC) provider URL from the Overview section of your EKS cluster. (You can find this under EKS > Your Cluster > Overview > Details.)
Go to the IAM service in the AWS Console.
Click Policies on the left panel, then click Create policy.
Select JSON as Policy editor.
Paste the following JSON schema in the policy editor.
Replace <your-region>
with your AWS region. (Find it in the top-right corner of the AWS Console.)
Replace <your-account-id>
with your AWS account ID. (You can find this under IAM > Account Settings.)
Replace <YOUR_LOG_GROUP_NAME>
with the CloudWatch log group name saved in Step 1.2.
Click Next and review the permissions.
After reviewing the permissions, click the Save Changes button.
Go to the IAM service in the AWS Console.
Click Roles on the left panel, then click Create role.
Select Web Identity as the trusted entity.
Choose your EKS OIDC provider and enter the audience as sts.amazonaws.com
.
Click Next and move to the permissions step.
Choose the policy we created in the previous step (3.1).
Click Next, give the role a name, and create the role. (Save the role name as it will be needed later.)
After creating the role, modify the trust policy in the Trust relationships section of the role created in the previous step.
Replace <your-region>
with your AWS region. (Find it in the top-right corner of the AWS Console.)
Replace <your-account-id>
with your AWS account ID. (You can find this under IAM > Account Settings.)
Replace <your-oidc-provider-id>
with the OIDC provider ID from Step 2.
Replace <your-namespace>
with the Kubernetes namespace where the service account will be deployed. (Use kubectl get namespaces
to check existing namespaces.)
Save the trust policy.
Create a service-account.yaml
file with the following content:
Replace <aws-account-id>
with your AWS account ID.
Replace <role-name>
with the IAM role name created in Step 3.2.
Replace <your-namespace>
with the Kubernetes namespace where the service account will be deployed (use kubectl get namespaces
to check existing namespaces). This should be the same as the one used in step 3.3.
Apply the service-account.yaml
file to your EKS cluster using the following kubectl
command: kubectl apply -f service-account.yaml
For LOG_GROUP_NAME
and AWS_REGION
, use the log group we saved earlier and the aws region it is deployed in.
For AKTO_KAFKA_BROKER_MAL
, use the value of the mini-runtime
service we deployed in step 1.1.
Replace <your-namespace>
with the Kubernetes namespace used in Step 4.
Notes:
For assigning an IAM role to a Kubernetes service account, you can refer here.
In-app support: Message us in the Akto dashboard.
Join our Discord channel for community support.
Email: Contact help@akto.io
.
Contact us here.