Connect Akto with AWS AppSync using Lambda Data Source
Last updated
Was this helpful?
Last updated
Was this helpful?
AWS AppSync is a fully managed GraphQL service from AWS. It allows you to build scalable applications by connecting to data sources like Lambda functions. By integrating AppSync with Akto using the Golang Runtime API Proxy Extension on AWS Lambda, you can automatically capture and monitor API traffic flowing through your GraphQL operations.
To connect Akto with AWS AppSync through Lambda functions, follow the steps below:
Before setting up the AppSync and Lambda integration, you need to deploy the Akto Data-Ingestion Service.
SSH into the instance where you want to deploy the data-ingestion service and run:
DATABASE_ABSTRACTOR_SERVICE_TOKEN
Log in to the Akto Dashboard.
Navigate to the Quick Start tab from the left panel.
Select Hybrid SaaS Connector and copy the token from the Runtime Service Command section.
docker-mini-runtime.env
FileEdit the file to include your token:
Start the service:
Ensure this instance is reachable from your Lambda environment. Note its public IP address or DNS name.
Now that the Akto Data-Ingestion Service is running, follow these steps to configure your AWS Lambda function and integrate it with AppSync.
Makefile
Update these values in the Makefile
:
Replace <your-lambda-function-name>
with your actual Lambda name.
You'll update the ingestion URL during function configuration.
This packages the Lambda Runtime API Proxy Extension for deployment.
Copy the output Layer ARN.
Run:
This will:
Attach the layer
Set required environment variables:
AWS_LAMBDA_EXEC_WRAPPER=/opt/wrapper-script.sh
AKTO_MIRRORING_URL=https://<your-ingestion-service-address>/api/ingestData
Now that your Lambda function is ready:
Go to the AWS AppSync console.
Open your GraphQL API.
Navigate to Data Sources.
Choose New and add your Lambda function as a data source.
Name it appropriately and attach the IAM role if required.
Whether you're using VTL or JavaScript, you must ensure your AppSync resolver sends an enriched payload to Lambda. This allows Akto to inspect incoming request context for observability.
📝 Note: Ensure
akto_data
includes the necessary context Akto requires.
Trigger a GraphQL query or mutation in your AppSync API.
Observe your Lambda logs to ensure Akto extension starts correctly.
Log in to Akto Dashboard and check if API traffic is captured under the associated collection.
If you run into any issues or want help with customizing your integration:
Reach out via in-app intercom
on the Akto Dashboard.
Join our Discord community.
Email us at help@akto.io.
Visit akto.io/contact-us for further assistance.