Discover AWS Gateway APIs in Service Catalog with the Konnect API
Install the AWS API Gateway integration in Konnect and authorize access with your Service Catalog role ARN, then link an API to your service.
Prerequisites
Kong Konnect
If you don’t have a Konnect account, you can get started quickly with our onboarding wizard.
- The following Konnect items are required to complete this tutorial:
- Personal access token (PAT): Create a new personal access token by opening the Konnect PAT page and selecting Generate Token.
-
Set the personal access token as an environment variable:
export KONNECT_TOKEN='YOUR KONNECT TOKEN'
Copied!
Konnect roles
You need the Integration Admin role in Konnect to install and authorize Service Catalog integrations.
AWS API Gateway
You need a REST API in AWS API Gateway to ingest and a correctly configured IAM role for this integration. You can name your AWS API Gateway API whatever you’d like. In this tutorial, we’ll refer to your AWS API Gateway API as aws-api
.
You can follow the setup instructions in the UI wizard when you add the AWS API Gateway instance or do the following:
Configure the AWS API Gateway integration
Before you can discover APIs in Service Catalog, you must configure the AWS API Gateway integration.
- In the Konnect sidebar, click Service Catalog.
- In the Service Catalog sidebar, click Integrations.
- Click AWS API Gateway.
- Click Add AWS API Gateway instance.
- From the AWS region dropdown, select “US East (Ohio)”. If you’re using a different region, select your region from the dropdown.
- In the IAM role ARN field, enter the IAM role you configured for Service Catalog.
- In the Display name field, enter
aws-api-gateway-test
. - In the Instance name field, enter
aws-api-gateway-test
. - Click Save.
Create a service in Service Catalog
Create a service that you’ll map to your AWS API Gateway resources:
curl -X POST "https://us.api.konghq.com/v1/catalog-services" \
-H "Authorization: Bearer $KONNECT_TOKEN" \
--json '{
"name": "billing",
"display_name": "Billing Service"
}'
Export the service ID:
export AWS_SERVICE_ID='YOUR-SERVICE-ID'
List AWS API Gateway resources
Before you can map your AWS API Gateway resources to a service in Service Catalog, you first need to find the resources that are pulled in from AWS API Gateway:
curl -X GET "https://us.api.konghq.com/v1/resources?filter%5Bintegration.name%5D=aws-api-gateway" \
-H "Authorization: Bearer $KONNECT_TOKEN"
You might need to manually sync your AWS API Gateway integration for resources to appear. From the Konnect UI by navigating to the AWS API Gateway integration you just installed and selecting Sync Now from the Actions dropdown menu.
Export the resource ID you want to map to the service:
export AWS_RESOURCE_ID='YOUR-RESOURCE-ID'
Map resources to a service
Now, you can map the AWS API Gateway resource to the service:
curl -X POST "https://us.api.konghq.com/v1/resource-mappings" \
-H "Authorization: Bearer $KONNECT_TOKEN" \
--json '{
"service": "billing",
"resource": "'$AWS_RESOURCE_ID'"
}'
Validate the mapping
To confirm that the AWS API Gateway resource is now mapped to the intended service, list the service’s mapped resources:
curl -X GET "https://us.api.konghq.com/v1/catalog-services/$AWS_SERVICE_ID/resources" \
-H "Authorization: Bearer $KONNECT_TOKEN"