@wheatstalk/cdk-apigatewayv2-ecs
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

ECS Service Discovery Integration

This project provides an AWS HTTP API Gateway integration to your ECS service by VPC Link.

See: Cheap serverless containers using API Gateway

Usage

declare const cluster: aws_ecs.Cluster;
declare const taskDefinition: aws_ecs.FargateTaskDefinition;

// Create your ECS service
const service = new aws_ecs.FargateService(stack, 'Service', {
  cluster,
  taskDefinition,
  // Enable CloudMap service discovery
  cloudMapOptions: {
    name: 'some-service',
    // Ensure that you use SRV-based records
    dnsRecordType: aws_servicediscovery.DnsRecordType.SRV,
  },
})

new aws_apigatewayv2.HttpApi(stack, 'HttpApi', {
  // Connect the HTTP API to your ECS service
  defaultIntegration: new EcsServiceDiscoveryIntegration('Nginx', {
    service,
  }),
});

Readme

Keywords

Package Sidebar

Install

npm i @wheatstalk/cdk-apigatewayv2-ecs

Weekly Downloads

1

Version

0.0.4

License

Apache-2.0

Unpacked Size

124 kB

Total Files

13

Last publish

Collaborators

  • misterjoshua