Skip to main content

AWS ECS Fargate (CDK)

Prerequisites

  1. A containerized GraphQL service that can be deployed to AWS ECS Fargate.
  2. An Inigo account setup as documented in our Getting Started guide.
  3. From #2, An Inigo service token value to set an INIGO_SERVICE_TOKEN environment variable.
  4. A logged in aws CLI session (for running the CDK).

Example Project using AWS CDK

The aws-cdk-examples repository contains both a TypeScript and a Go example demonstrating the use of the AWS Cloud Development Kit (CDK) for configuring and deploying ECS Fargate GraphQL services with an Inigo sidecar container.

The index.ts or the main.go can be customized for your needs, specifically replacing the inigohub/starwars:latest example GraphQL service with your own containerized GraphQL service.

Deploy the Example Project

1. Create an Inigo Service Token AWS Secret

Create an AWS Secret using the INIGO_SERVICE_TOKEN value, either via the AWS User Interface or using the AWS CLI by executing the following command:

aws secretsmanager create-secret --name InigoServiceToken --secret-string '{"SERVICE_TOKEN":"Insert INIGO_SERVICE_TOKEN"}'

Be sure to copy and paste the INIGO_SERVICE_TOKEN value into the commend for the SERVICE_TOKEN value.

2. Initialize and Deploy the CDK

Before you deploy a CDK stack into an AWS environment, the environment must first be bootstrapped:

cdk bootstrap

Deploy the ECS Fargate stack using the CDK:

cdk deploy

After a successful deployment, the CDK will output the ALB endpoint. Copy and paste it into the browser to check that the Starwars GraphQL service is running and to load the GraphQL playground. For example: http://InigoS-LoadB-xxxx-xxxxx.us-west-2.elb.amazonaws.com.

Note: Be sure to prefix the ALB endpoint with http:// as your browser may initially force https, which will not work as an SSL certificate is not installed in the example project.

Note: The Standalone agent documentation provides more information about all of the available environment variables for the sidecar container.