@wheatstalk/cdk-apigatewayv2-ecs
v0.0.4
Published
Integrates HTTP API Gateway to ECS by VPC Link
Downloads
47
Readme
ECS Service Discovery Integration
This project provides an AWS HTTP API Gateway integration to your ECS service by VPC Link.
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,
}),
});