Install BDOT Collector in AWS ECS EC2
Deploy BDOT Collector on AWS ECS EC2 for cost-effective, scalable collector deployment with full control over underlying infrastructure.
This guide walks you through deploying BDOT Collector on AWS ECS using EC2 launch type. EC2 provides full control over the underlying infrastructure and can be more cost-effective for consistent workloads.
Prerequisites
Before starting, ensure you have:
AWS CLI v2.x installed and configured with appropriate permissions
Valid AWS account with permissions to create ECS, VPC, and IAM resources
Bindplane Server running and accessible (self-hosted or cloud)
Collector secret key from your Bindplane Server
Basic understanding of AWS ECS, VPC, and container concepts
Quick Deployment with CloudFormation
For a quick deployment, you can use the provided CloudFormation template that creates all the necessary infrastructure automatically. This is the recommended approach for most users.
CloudFormation Template
The following CloudFormation template creates all the required AWS resources for BDOT Collector on ECS EC2:
AWSTemplateFormatVersion: '2010-09-09'
Description: 'BDOT Collector on AWS ECS EC2 with Auto Scaling and VPC'
Parameters:
CollectorSecretKey:
Type: String
Description: BDOT Collector secret key from Bindplane Server
NoEcho: true
OpampEndpoint:
Type: String
Description: OpAMP endpoint URL
Default: 'wss://app.bindplane.com/v1/opamp'
AllowedPattern: '^(ws|wss)://.*'
CollectorImage:
Type: String
Description: BDOT Collector Docker image
Default: 'ghcr.io/observiq/bindplane-agent:1.84.0'
Environment:
Type: String
Description: Environment name (used for resource naming)
Default: prod
AllowedValues: [dev, staging, prod]
InstanceType:
Type: String
Description: EC2 instance type for ECS cluster
Default: t3.medium
AllowedValues: [t3.small, t3.medium, t3.large, t3.xlarge, m5.large, m5.xlarge]
MinSize:
Type: Number
Description: Minimum number of EC2 instances
Default: 1
MinValue: 1
MaxValue: 10
MaxSize:
Type: Number
Description: Maximum number of EC2 instances
Default: 5
MinValue: 1
MaxValue: 20
DesiredCapacity:
Type: Number
Description: Desired number of EC2 instances
Default: 2
MinValue: 1
MaxValue: 10
Resources:
# VPC and Networking
VPC:
Type: AWS::EC2::VPC
Properties:
CidrBlock: 10.0.0.0/16
EnableDnsHostnames: true
EnableDnsSupport: true
Tags:
- Key: Name
Value: !Sub '${Environment}-bindplane-collector-vpc'
# Internet Gateway
InternetGateway:
Type: AWS::EC2::InternetGateway
Properties:
Tags:
- Key: Name
Value: !Sub '${Environment}-bindplane-collector-igw'
InternetGatewayAttachment:
Type: AWS::EC2::VPCGatewayAttachment
Properties:
InternetGatewayId: !Ref InternetGateway
VpcId: !Ref VPC
# Public Subnets
PublicSubnet1:
Type: AWS::EC2::Subnet
Properties:
VpcId: !Ref VPC
AvailabilityZone: !Select [0, !GetAZs '']
CidrBlock: 10.0.1.0/24
MapPublicIpOnLaunch: true
Tags:
- Key: Name
Value: !Sub '${Environment}-bindplane-collector-public-1a'
PublicSubnet2:
Type: AWS::EC2::Subnet
Properties:
VpcId: !Ref VPC
AvailabilityZone: !Select [1, !GetAZs '']
CidrBlock: 10.0.2.0/24
MapPublicIpOnLaunch: true
Tags:
- Key: Name
Value: !Sub '${Environment}-bindplane-collector-public-1b'
# Route Tables
PublicRouteTable:
Type: AWS::EC2::RouteTable
Properties:
VpcId: !Ref VPC
Tags:
- Key: Name
Value: !Sub '${Environment}-bindplane-collector-public-rt'
DefaultPublicRoute:
Type: AWS::EC2::Route
DependsOn: InternetGatewayAttachment
Properties:
RouteTableId: !Ref PublicRouteTable
DestinationCidrBlock: 0.0.0.0/0
GatewayId: !Ref InternetGateway
PublicSubnet1RouteTableAssociation:
Type: AWS::EC2::SubnetRouteTableAssociation
Properties:
RouteTableId: !Ref PublicRouteTable
SubnetId: !Ref PublicSubnet1
PublicSubnet2RouteTableAssociation:
Type: AWS::EC2::SubnetRouteTableAssociation
Properties:
RouteTableId: !Ref PublicRouteTable
SubnetId: !Ref PublicSubnet2
# Security Groups
CollectorSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Security group for BDOT Collector
VpcId: !Ref VPC
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: 4317
ToPort: 4317
CidrIp: 0.0.0.0/0
Description: OTLP gRPC
- IpProtocol: tcp
FromPort: 4318
ToPort: 4318
CidrIp: 0.0.0.0/0
Description: OTLP HTTP
- IpProtocol: tcp
FromPort: 13133
ToPort: 13133
CidrIp: 0.0.0.0/0
Description: Health check
- IpProtocol: tcp
FromPort: 55679
ToPort: 55679
CidrIp: 0.0.0.0/0
Description: ZPages debugging
- IpProtocol: tcp
FromPort: 22
ToPort: 22
CidrIp: 0.0.0.0/0
Description: SSH access
Tags:
- Key: Name
Value: !Sub '${Environment}-bindplane-collector-sg'
# IAM Roles
TaskExecutionRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
Service: ecs-tasks.amazonaws.com
Action: sts:AssumeRole
ManagedPolicyArns:
- arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy
Tags:
- Key: Name
Value: !Sub '${Environment}-bindplane-collector-execution-role'
TaskRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
Service: ecs-tasks.amazonaws.com
Action: sts:AssumeRole
Tags:
- Key: Name
Value: !Sub '${Environment}-bindplane-collector-task-role'
ECSInstanceRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
Service: ec2.amazonaws.com
Action: sts:AssumeRole
ManagedPolicyArns:
- arn:aws:iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role
Tags:
- Key: Name
Value: !Sub '${Environment}-bindplane-collector-instance-role'
ECSInstanceProfile:
Type: AWS::IAM::InstanceProfile
Properties:
Roles:
- !Ref ECSInstanceRole
# CloudWatch Log Group
LogGroup:
Type: AWS::Logs::LogGroup
Properties:
LogGroupName: !Sub '/ecs/${Environment}-bindplane-collector'
RetentionInDays: 30
# ECS Cluster
ECSCluster:
Type: AWS::ECS::Cluster
Properties:
ClusterName: !Sub '${Environment}-bindplane-collector-cluster'
# Launch Template
LaunchTemplate:
Type: AWS::EC2::LaunchTemplate
DependsOn: ECSInstanceProfile
Properties:
LaunchTemplateName: !Sub '${Environment}-bindplane-collector-lt'
LaunchTemplateData:
ImageId: !Sub '{{resolve:ssm:/aws/service/ecs/optimized-ami/amazon-linux-2/recommended/image_id}}'
InstanceType: !Ref InstanceType
IamInstanceProfile:
Arn: !GetAtt ECSInstanceProfile.Arn
SecurityGroupIds:
- !Ref CollectorSecurityGroup
UserData:
Fn::Base64: !Sub |
#!/bin/bash
echo ECS_CLUSTER=${ECSCluster} >> /etc/ecs/ecs.config
echo ECS_ENABLE_TASK_ENI=true >> /etc/ecs/ecs.config
BlockDeviceMappings:
- DeviceName: /dev/xvda
Ebs:
VolumeSize: 30
VolumeType: gp3
# Auto Scaling Group
AutoScalingGroup:
Type: AWS::AutoScaling::AutoScalingGroup
DependsOn: LaunchTemplate
Properties:
AutoScalingGroupName: !Sub '${Environment}-bindplane-collector-asg'
LaunchTemplate:
LaunchTemplateId: !Ref LaunchTemplate
Version: !GetAtt LaunchTemplate.LatestVersionNumber
MinSize: !Ref MinSize
MaxSize: !Ref MaxSize
DesiredCapacity: !Ref DesiredCapacity
VPCZoneIdentifier:
- !Ref PublicSubnet1
- !Ref PublicSubnet2
HealthCheckType: EC2
HealthCheckGracePeriod: 300
Tags:
- Key: Name
Value: !Sub '${Environment}-bindplane-collector-instance'
PropagateAtLaunch: true
# ECS Task Definition
TaskDefinition:
Type: AWS::ECS::TaskDefinition
Properties:
Family: !Sub '${Environment}-bindplane-collector'
NetworkMode: host
RequiresCompatibilities:
- EC2
Cpu: 512
Memory: 1024
ExecutionRoleArn: !Ref TaskExecutionRole
TaskRoleArn: !Ref TaskRole
ContainerDefinitions:
- Name: bdot-collector
Image: !Ref CollectorImage
PortMappings:
- ContainerPort: 4317
Protocol: tcp
- ContainerPort: 4318
Protocol: tcp
- ContainerPort: 13133
Protocol: tcp
- ContainerPort: 55679
Protocol: tcp
Environment:
- Name: OPAMP_ENDPOINT
Value: !Ref OpampEndpoint
- Name: OPAMP_SECRET_KEY
Value: !Ref CollectorSecretKey
- Name: OPAMP_LABELS
Value: !Sub 'environment=${Environment},platform=aws-ecs-ec2'
- Name: MANAGER_YAML_PATH
Value: /etc/otel/storage/manager.yaml
LogConfiguration:
LogDriver: awslogs
Options:
awslogs-group: !Ref LogGroup
awslogs-region: !Ref AWS::Region
awslogs-stream-prefix: ecs
# ECS Service
ECSService:
Type: AWS::ECS::Service
Properties:
ServiceName: !Sub '${Environment}-bindplane-collector-service'
Cluster: !Ref ECSCluster
TaskDefinition: !Ref TaskDefinition
DesiredCount: !Ref DesiredCapacity
LaunchType: EC2
Outputs:
VPCId:
Description: VPC ID
Value: !Ref VPC
Export:
Name: !Sub '${Environment}-bindplane-collector-vpc-id'
ECSClusterName:
Description: ECS Cluster Name
Value: !Ref ECSCluster
Export:
Name: !Sub '${Environment}-bindplane-collector-cluster-name'
ServiceName:
Description: ECS Service Name
Value: !Ref ECSService
Export:
Name: !Sub '${Environment}-bindplane-collector-service-name'
TaskDefinitionArn:
Description: ECS Task Definition ARN
Value: !Ref TaskDefinition
Export:
Name: !Sub '${Environment}-bindplane-collector-task-definition-arn'
AutoScalingGroupName:
Description: Auto Scaling Group Name
Value: !Ref AutoScalingGroup
Export:
Name: !Sub '${Environment}-bindplane-collector-asg-name'Deploy with CloudFormation
Save the template above as bindplane-collector-ecs-ec2.yaml and deploy it:
Architecture Overview
The deployment includes:
ECS EC2 Cluster: Managed EC2 instances running BDOT Collector
Auto Scaling Group: Manages EC2 instances for the cluster
VPC with Public Subnets: Network isolation with internet access
Host Networking: Containers use EC2 instance's network interface directly
Security Groups: Controlled access to collector ports
CloudWatch: Monitoring and logging
Auto Scaling: Configurable number of collector instances
Container Architecture
The ECS task runs a single container:
BDOT Collector (ghcr.io/observiq/bindplane-agent:1.84.0)
OpenTelemetry collector on ports 4317 (gRPC), 4318 (HTTP), 13133 (health), 55679 (ZPages)
Connects to Bindplane Server via OpAMP protocol
Automatically receives configurations from Bindplane Server
Persistent storage for manager.yaml configuration
Manual Deployment Steps
If you prefer to understand each component or need custom configurations, you can follow the manual deployment steps below.
Step 1: Set Up AWS Infrastructure
Important: Follow these steps in order, as later steps depend on resources created in earlier steps.
1.1 Create VPC and Networking
1.2 Create Security Group
Step 2: Create ECS Resources
2.1 Create IAM Roles
2.2 Create CloudWatch Log Group
2.3 Create ECS Cluster
Step 3: Create Launch Template and Auto Scaling Group
3.1 Get Latest ECS-Optimized AMI
3.2 Create Launch Template
3.3 Create Auto Scaling Group
Step 4: Create Task Definition
Step 5: Create ECS Service
Configuration and Management
Connecting to Bindplane Server
Get your collector secret key from your Bindplane Server:
Navigate to Agents → Install Agent
Choose Linux platform
Copy the
secret-key
Update the OpAMP endpoint in your task definition:
For Bindplane Cloud:
wss://app.bindplane.com/v1/opampFor self-hosted:
ws://your-server:3001/v1/opamp(orwss://with TLS)
Update the task definition with your secret key:
Scaling Collectors
Manual Scaling
Auto Scaling with Application Auto Scaling
Monitoring and Logging
CloudWatch Logs
CloudWatch Metrics
The ECS service automatically sends metrics to CloudWatch:
CPU and Memory utilization
Task count and health
Network I/O
Health Checks
The collector includes health checks on port 13133:
Health endpoint:
http://localhost:13133/ZPages debugging:
http://localhost:55679/
TLS Configuration
For Self-Hosted Bindplane with TLS
If your Bindplane Server uses TLS with a custom CA:
Then update your task definition to include:
Troubleshooting
Common Issues
Collector Not Appearing in Bindplane
Check OpAMP endpoint: Ensure the endpoint URL is correct
Verify secret key: Make sure the secret key matches your Bindplane Server
Check network connectivity: Ensure the collector can reach the Bindplane Server
Review logs: Check CloudWatch logs for connection errors
High CPU/Memory Usage
Scale up resources: Increase CPU/memory in task definition
Scale out: Add more collector instances
Optimize configuration: Review collector configuration for efficiency
Best Practices
Resource Sizing: Start with 512 CPU / 1024 Memory, adjust based on load
Scaling: Use Application Auto Scaling for automatic scaling
Monitoring: Set up CloudWatch alarms for key metrics
Security: Use IAM roles with minimal required permissions
Logging: Enable detailed logging for troubleshooting
Updates: Regularly update collector image versions
Cleanup
To remove all resources created by this guide:
Next Steps
After successfully deploying your BDOT Collector:
Verify connection in your Bindplane Server UI
Create configurations for your collectors
Set up monitoring and alerting
Configure auto-scaling based on your needs
Review security settings and access controls
Last updated
Was this helpful?