Akto - API Security platform
Akto WebsiteStart freeBook a demoDiscordGitHub
  • Github Open Source Repo
  • What is Akto?
  • AktoGPT
  • AGENTIC AI
    • Akto MCP Server
  • Getting Started
    • Deployment Types
    • Akto Cloud
      • Connect Akto with Hybrid SaaS
      • Migrate From Self Hosted Setup To SaaS
      • Setting up proxy
    • Akto Self Hosted
      • AWS deploy
        • AWS multi-VPC deploy
        • AWS Cross-Region Cross-VPC deploy
        • Custom subdomain on Akto on AWS
      • Helm Deploy
      • Azure Deploy
      • Openshift Deploy
      • Heroku
      • GCP Deploy
    • Local Deploy
    • FAQs on data concerns
  • Traffic Connector
    • Traffic Data Sources
    • eBPF
      • Connect Akto with eBPF
      • Connect Akto with eBPF on mTLS
    • Kubernetes
      • Connect Akto with Kubernetes in AWS
      • Connect Akto eBPF with Kubernetes
    • API Gateways
      • Connect Akto with Envoy
      • Connect Akto with NGINX
      • Connect Akto with Istio
      • Connect Akto with HAProxy
      • Connect Akto with Azure API Management
      • Connect Akto with F5
      • Connect Akto with 3Scale
      • Connect Akto with Layer7 API Gateway
      • Connect Akto with Citrix
      • Connect Akto with Kong
      • Connect Akto with Kong Mesh
      • Connect Akto with Cloudflare
      • Connect Akto with IBM Connect
      • Connect Akto with Mulesoft Flex Gateway
      • Connect Akto with Apigee
    • Mirroring
      • Connect Akto with AWS Traffic Mirroring
      • Connect Akto with GCP Packet Mirroring
    • AWS Services
      • Connect Akto with AWS Beanstalk
      • Connect Akto with AWS API Gateway
      • Connect Akto with AWS Lambda
      • Connect Akto with AWS API Gateway with CloudWatch OAM
      • Connect Akto with AWS API Gateway with service account (Temporary Credentials)
      • Connect Akto with AWS Fargate
      • Connect Akto with AWS EKS
      • Connect Akto with AWS ECS
    • GCP Services
      • Connect Akto with GCP Packet Mirroring
      • Connect Akto with Apigee
      • Connect Akto with Google Cloud Run Functions
      • Connect Akto with Google Cloud Run
      • Connect Akto with GKE
    • Azure Services
      • Connect Akto with Azure App Services
      • Connect Akto with Azure API Management
      • Connect Akto with AKS
      • Connect Akto with Azure OpenShift
      • Connect Akto with Azure Container App
      • Connect Akto with Azure Functions
    • Akto SDK
    • Source Code
      • GitHub
      • Bitbucket
      • GitLab
      • API inventory from source code
      • Source code installation
    • Virtual Machines
      • Connect Akto with Docker
      • Connect Akto on TLS service
      • Connect Akto with TCP Agent
    • Manual
      • Connect Akto with Burp suite
      • Connect Akto with Postman
      • Connect Akto with OpenAPI
      • Add API traffic to Akto using HAR file upload
      • API Import: WSDL in Akto
    • Configure TLS on kafka
  • API Inventory
    • Concepts
      • API Endpoints
      • Meta Properties of API Endpoint
      • API Collection
      • API Call Stats
      • Explore mode
      • gRPC API Coverage with Akto
      • Data Types
      • API Groups
      • Environment Type
      • Protocol Support in Akto
      • API Changes
      • Third Party APIs
      • Tags
      • API Dependency Graph
      • Sensitive Data
      • Alerts
      • Shadow APIs
      • Zombie APIs
      • Risk Score
      • Auth types
      • Access Type
      • API discovery from source code
      • Advanced Filter Option
    • How-To
      • Enable Tree view for API collections
      • Export an API Collection to Postman
      • Export an API Collection to Burp
      • Create API group
      • Collection-Based RBAC
      • Descriptions for API Collections & Endpoints
      • Remove API(s) from API group
      • Deactivating and Reactivating API Collections in Akto
      • Add collection using Explore Mode
      • De-merge API
      • Create Swagger File Using Akto
      • Copy API Endpoints Data
      • Add an API Collection
      • Set environment type
      • Delete an API Collection
      • Create a Custom Data Type
      • Reset Data Types in Akto
      • Set Sensitivity of a Data Type
      • De-activate a data type
      • Add a Custom Auth Type
      • Reset an Auth Type
      • Configure Access Types
      • View New API Endpoint
      • Add Private CIDRs list
      • View New Parameters
      • Configure alerts on API changes
      • Create a custom collection
      • Redact sensitive data
      • Extract APIs from github hosted source code using our Github Action
      • Extract APIs from source code using our Docker based CLI
      • Remove Bad Endpoints
      • Create New Tags
      • Edit Tags
  • API Protection
    • Overview
    • External API Runtime Threat Notifications
    • Concepts
      • Threat Actors
      • Threat Policy
  • WAF
    • AWS WAF
    • Cloudflare WAF
  • Test Editor
    • Concepts
      • Overview
      • Test YAML
      • Test Library
      • Custom Test
      • Test YAML Syntax (Detailed)
        • ID
        • Info
        • Wordlists
        • Auth
        • API Selection Filters
        • Execute
        • Validation
        • Contexts
        • Strategy
        • Conditional flows
      • Template YAMLs
        • Local File Inclusion with Akto
      • Dynamic severity
    • How To
      • Edit Test
      • Create a Custom Test
      • Deactivate Test
      • Play in Test Editor Background
      • Copy Test Content
      • Opening Endpoint in Test Editor
      • Add a New Test Library
      • Contribute to Test Library
  • API Security Testing
    • Concepts
      • Severity Levels
      • Test
      • Result types
      • Test Role
      • User Config
      • Test Result
      • JSON Recording for Automated Auth Tokens
    • How To
      • Run Test
      • Auto-Create Jira Tickets
      • Edit Test Settings
      • Install testing module in your Cloud
        • Ephemeral Storage for Hybrid Runtime
        • gRPC Testing in Hybrid Testing Module
      • Create Custom Test Suites
      • Recalculate Issue Counts
      • Testing Module Selector in Akto
      • Run Tests by Category
      • Export Vulnerability Report from Test Results
      • Test Multiple APIs
      • Schedule Tests
      • Stop Tests
      • Run Test on Any One Endpoint
      • Configure global rate limit
      • Rescan Specific Issues Resolved
      • Configure Pre-request Script
      • Set Up JSON Recording for Auth Tokens
      • Create a Test Role
      • Edit Auth Flow in Test Roles
      • Restrict Access to a Test Role Using RBAC
      • Play in Test Editor Playground
      • Conduct Role-Based Testing
      • Run tests in CLI using Akto
      • Secure GraphQL APIs using Akto
      • Secure REST APIs using Akto
      • Secure SOAP APIs using Akto
      • Create and Edit Auth Types
  • Issues
    • Concepts
      • Overview
      • Values
      • Vulnerability Report
      • Remediation
    • How To
      • Jira Integration
      • Azure DevOps Boards Integration
      • Triage Issues
        • Review Issues Marked as False Positives
      • Export Selected Issues to Reports
      • Export Vulnerability Report
  • CI/CD
    • GitHub Actions
      • Create GitHub App
    • Jenkins
    • Azure DevOps
    • GitLab
    • Generic CI/CD
    • How To
      • Run tests in CI/CD
      • Add test to CI/CD Pipeline
      • Get API Credentials
      • Test ID from Akto test
  • Account
    • Invite User
      • Change role of a User
    • Create a New Account
    • How to Switch Between Accounts in Akto
    • Understanding Role Permissions
    • Custom roles
    • Audit Logs
    • SSO
      • Azure AD SAML
      • Okta OIDC
      • Github OIDC
      • Google Workspace SSO
      • Add Members From SSO
  • Compliance
    • Concepts
      • Overview
  • API security posture
    • Concepts
      • Overview
  • SIEM Integration
    • Splunk
  • Alerts
    • Slack Webhook
    • Microsoft Teams Webhook
    • Setup alerts for Akto test run results
  • Pricing
    • Pricing Plans
    • How To
      • Upgrade Your Plan
      • Downgrade Your Plan
      • Sync Usage Data
  • API reference
    • API reference
  • Components
    • Dashboard
    • Testing module
    • Traffic mirroring module
    • Runtime analyzer
    • Context analyzer
    • Puppeteer server
    • Other OSS
    • robots.txt
  • Troubleshooting
    • How to get logs
    • How to disable logging
    • How to update helm deployments
  • Stay Updated on New Releases
  • Support
Powered by GitBook
On this page
  • Step 1: Set Up and Configure API Gateway
  • 1.1 Set up Akto Traffic Processor
  • 1.2 Add AWS API Gateway Connector
  • Step 2: Set Up Cross-Account IAM Role for CloudWatch Logs
  • 2.1 Create IAM Role in CloudWatch Account
  • 2.2 Update Trust Policy
  • Step 3: Create an IAM Role for EKS Service Account
  • 3.1 Create an IAM Policy in EKS Account
  • 3.2 Create IAM Role for Service Account
  • 3.3 Update Trust Policy for IRSA Role
  • Step 4: Attach IAM Role to EKS Service Account
  • Step 5: Update the Kubernetes Deployment YAML
  • Note:
  • Get Support for your Akto setup

Was this helpful?

  1. Traffic Connector
  2. AWS Services

Connect Akto with AWS API Gateway with service account (Temporary Credentials)

PreviousConnect Akto with AWS API Gateway with CloudWatch OAMNextConnect Akto with AWS Fargate

Last updated 2 months ago

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:


Step 1: Set Up and Configure API Gateway

1.1 Set up Akto Traffic Processor

1.2 Add AWS API Gateway Connector

  1. Go to API Gateway in the AWS Console.

  2. Navigate to your API and click on Stages from the left menu.

  3. Scroll down to the Logs and tracing section and click on Edit.

  4. Select Error and info logs and Data tracing and save these settings.

  5. Find out the CloudWatch log group for your API Gateway for the stage which has the above logs enabled and save its ARN. You'll need it later.


Step 2: Set Up Cross-Account IAM Role for CloudWatch Logs

If your EKS cluster and CloudWatch log groups are in different AWS accounts, follow these steps to enable access using IAM roles with temporary credentials.

2.1 Create IAM Role in CloudWatch Account

  1. Go to the IAM service in the AWS Console of the account where CloudWatch logs are stored.

  2. Click Roles on the left panel, then click Create role.

  3. Choose Another AWS account as the trusted entity.

  4. Enter the AWS Account ID of the EKS cluster account.

  5. Click Next, and in the permissions step, create a new policy or attach an existing one with the following permissions:

    {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Effect": "Allow",
          "Action": [
            "logs:DescribeLogGroups",
            "logs:DescribeLogStreams",
            "logs:GetLogEvents",
            "logs:FilterLogEvents"
          ],
          "Resource": "arn:aws:logs:<region>:<cloudwatch-account-id>:log-group:<log-group-name>:*"
        }
      ]
    }
  6. Replace <region>, <cloudwatch-account-id>, and <log-group-name> with actual values.

  7. Click Next, name the role (e.g., CrossAccountCloudWatchRole), and create the role.

2.2 Update Trust Policy

After creating the role, modify the Trust relationships section to allow access from the EKS IRSA role:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::<eks-account-id>:role/<irsa-role-name>"
            },
            "Action": "sts:AssumeRole"
        }
    ]
}
  • Replace <eks-account-id> with the AWS account ID where EKS is running.

  • Replace <irsa-role-name> with the IAM role attached to the EKS service account.


Step 3: Create an IAM Role for EKS Service Account

3.1 Create an IAM Policy in EKS Account

  1. Go to IAM service in the AWS Console of the EKS cluster account.

  2. Click Policies, then Create policy.

  3. Use the following JSON policy:

    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Effect": "Allow",
                "Action": "sts:AssumeRole",
                "Resource": "arn:aws:iam::<cloudwatch-account-id>:role/CrossAccountCloudWatchRole"
            }
        ]
    }
  4. Replace <cloudwatch-account-id> with the AWS account ID where CloudWatch logs are stored.

  5. Click Next, give the policy a name (e.g., EKSCloudWatchAccess), and create it.

3.2 Create IAM Role for Service Account

  1. In the EKS cluster account, go to IAM and click Roles > Create role.

  2. Select Web Identity as the trusted entity.

  3. Choose your EKS OIDC provider and enter sts.amazonaws.com as the audience.

  4. Attach the policy created in Step 3.1.

  5. Name the role (e.g., EKSCloudWatchRole) and create it.

3.3 Update Trust Policy for IRSA Role

Modify the trust policy for the role created in Step 3.2:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "Federated": "arn:aws:iam::<eks-account-id>:oidc-provider/oidc.eks.<region>.amazonaws.com/id/<oidc-provider-id>"
            },
            "Action": "sts:AssumeRoleWithWebIdentity",
            "Condition": {
                "StringEquals": {
                    "oidc.eks.<region>.amazonaws.com/id/<oidc-provider-id>:sub": "system:serviceaccount:<namespace>:service-account-eks"
                }
            }
        }
    ]
}
  • Replace placeholders with actual values.


Step 4: Attach IAM Role to EKS Service Account

  1. Create a service-account.yaml file:

    apiVersion: v1
    kind: ServiceAccount
    metadata:
      name: service-account-eks
      namespace: <namespace>
      annotations:
        eks.amazonaws.com/role-arn: arn:aws:iam::<eks-account-id>:role/EKSCloudWatchRole
  2. Apply the service account:

    kubectl apply -f service-account.yaml

Now, the EKS pod using this service account can assume the cross-account IAM role to access CloudWatch logs securely.

Step 5: Update the Kubernetes Deployment YAML

apiVersion: apps/v1
kind: Deployment
metadata:
  name: api-gateway-logging
  namespace: <namespace>
spec:
  replicas: 1
  selector:
    matchLabels:
        app: api-gateway-logging 
  template:
    metadata:
        labels:
          app: api-gateway-logging 
    spec:
      serviceAccountName: service-account-eks
      containers:
      - image: aktosecurity/mirror-api-logging:api-gateway-logging-temp-cred
        name: api-gateway-logging 
        imagePullPolicy: Always
        resources: {}
        env:
          - name: AKTO_BYTES_IN_THRESHOLD
            value: "100"
          - name: AKTO_TRAFFIC_BATCH_TIME_SECS
            value: "10"
          - name: AKTO_TRAFFIC_BATCH_SIZE
            value: "100"
          - name: AKTO_KAFKA_BROKER_MAL
            value: ""
          - name: CLOUDWATCH_READ_BATCH_SIZE
            value: "5"
          - name: LOG_GROUP_ARN
            value: ""
          - name: CROSS_ACCOUNT_ROLE_ARN
            value: ""
          - name: SESSION_NAME
            value: ""
          - name: AWS_REGION
            value: ""
  • Replace <namespace> with the Kubernetes namespace used in Steps 3.3 and 4.

  • For AKTO_KAFKA_BROKER_MAL, use the value of the mini-runtime service deployed in Step 1.1.

  • For <LOG_GROUP_ARN>, enter the value obtained in Step 1.2.5.

  • For <SESSION_NAME>, use any name you want for the session.

  • Replace <AWS_REGION> with the AWS region where your EKS cluster is located.

Note:

To use multiple Log group ARNs, use the image aktosecurity/mirror-api-logging:api-gateway-logging-temp-cred-multiple-arn in the template provided above and fill the environment variable <LOG_GROUP_ARN> as the show in the example here

LOG_GROUP_ARN=arn:aws:logs:ap-south-1:021978053257:log-group:API-Gateway-Execution-Logs_juroiydk3c/Dev:*,arn:aws:logs:ap-south-1:021978053257:log-group:API-Gateway-Execution-Logs_juroiydk3c/Dev2:*,arn:aws:logs:ap-south-1:021978053257:log-group:API-Gateway-Execution-Logs_juroiydk3c/Dev3:*

With this setup, Akto can fetch CloudWatch logs from API Gateway across AWS accounts using temporary credentials.


Get Support for your Akto setup

  • In-app support: Message us in the Akto dashboard.

  • Email: Contact help@akto.io.

Follow the steps mentioned to set up the Akto Traffic Processor.

Join our for community support.

Contact us .

here
Discord channel
here