简体   繁体   中英

CloudFormation - How to add the bootsrap parameter to Ksql Server

I'm using CloudFormation scripts to build an EC2 container of Ksql Server (Docker container). I have already built the other components within MSK Ie Bootstrap servers and listeners.

Within the AWS::ECS::TaskDefinition I have tried to add the bootstrap servers and listeners by using the 'Container' & 'Environment' properties within 'ContainerDefinition'. Although doing this puts the EcsService in a stuck position as the status stays as CREATE_IN_PROGRESS.

# Creating the ECS Task for KsqlDB
  EcsKsqlTask:
    Type: AWS::ECS::TaskDefinition
    Properties: 
      NetworkMode: awsvpc
      Cpu: '256'
      Memory: '1024'
      RequiresCompatibilities: 
        - EC2
      ContainerDefinitions:
          - Name: KsqlServer
            Image: 123.dkr.ecr.eu-west-2.amazonaws.com/confluentinc/cp-ksql-server
            Essential: true
            # Environment: 
            #   Name: KSQL_BOOTSTRAP_SERVERS
            #   Value: b-1.kafka.123.d1.eu-west-2.amazonaws.com:9092
            Command: 
              - 'bin/bash docker run -d \ -v / KSQL_BOOTSTRAP_SERVERS=b-1.kafka.123.c3.eu-west-2.amazonaws.com:9092 \ -e KSQL_KSQL_SERVICE_ID=ksql_standalone_1_ \ -e KSQL_KSQL_QUERIES_FILE=/path/in/container/queries.sql \ confluentinc/ksqldb-server:0.26.0'
            PortMappings:
            - ContainerPort: 8080
              Protocol: tcp
            - ContainerPort: 22
              Protocol: tcp
      ExecutionRoleArn: !Ref EcsRole
      TaskRoleArn: !Ref EcsRole
  
  # Creating the ECS Service for KsqlDB
  EcsService:
    Type: AWS::ECS::Service
    Properties: 
      ServiceName: EcsKsqlService
      TaskDefinition: !Ref EcsKsqlTask
      Cluster: !Ref EcsCluster
      LaunchType: EC2
      NetworkConfiguration:
        AwsvpcConfiguration:
          AssignPublicIp: DISABLED
          SecurityGroups:
          - !Ref EcsSecurityGroup
          Subnets:
          - !Ref PrivateSubnetOne
          - !Ref PrivateSubnetTwo

Any help on any property I am missing would be greatly appreciated

Added as so

      ContainerDefinitions:
      - Name: KsqlCli
        Image: Images/ksql-cli
        Essential: true
        Environment: 
          - Name: KSQL_BOOTSTRAP_SERVERS
            Value: b-3.boostrap.amazonaws.com
          - Name: KSQL_KSQL_SERVICE_ID
            Value: confluent_ksql_01
          - Name: KSQL_LISTENERS
            Value: http://localhost:8088

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM