How to use the @aws-cdk/aws-ecs.LoadBalancedFargateService function in @aws-cdk/aws-ecs

To help you get started, we’ve selected a few @aws-cdk/aws-ecs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nathanpeck / screenshot-service / app.3.js View on Github external
constructor(parent, id, props) {
    super(parent, id, props);

    // Create an API service
    this.api = new ecs.LoadBalancedFargateService(this, 'api', {
      cluster: props.cluster,
      image: ecs.ContainerImage.fromAsset(this, 'api-image', {
        directory: './api'
      }),
      desiredCount: 2,
      cpu: '256',
      memory: '512',
      environment: {
        QUEUE_URL: props.screenshotQueue.queueUrl,
        TABLE: props.screenshotTable.tableName
      },
      createLogs: true
    });

    props.screenshotQueue.grantSendMessages(this.api.service.taskDefinition.taskRole);
    props.screenshotTable.grantReadWriteData(this.api.service.taskDefinition.taskRole);