- Uses official RabbitMQ docker image.
- Creates
N
nodes inM
subnets - Creates Autoscaling Group and ELB to load balance nodes
- Makes sure nodes can talk to each other and create cluster
- Make sure new nodes attempt to join the cluster at startup
- Configures
/
vhost queues in High Available (Mirrored) mode with automatic synchronization ("ha-mode":"all", "ha-sync-mode":"3"
) - Installs and configures Datadog Agent to gather metrics and logs for RabbitMQ
Copy and paste into your Terraform configuration:
module "rabbitmq" {
source = "smartrent/rabbitmq/aws"
vpc_id = var.vpc_id
ssh_key_name = var.ssh_key_name
subnet_ids = var.subnet_ids
elb_additional_security_group_ids = [var.cluster_security_group_id]
min_size = "3"
max_size = "3"
desired_size = "3"
dd_env = var.env_name
dd_site = var.datadog_site
kms_key_arn = var.kms_key_id
ecr_registry_id = var.ecr_registry_id
rabbitmq_image = var.rabbitmq_image
}
then run terraform init
, terraform plan
and terraform apply
.
Are 3 node not enough ? Update sizes to 5
and run terraform apply
again,
it will update Autoscaling Group and add 2
nodes more. Dead simple.
Node becomes unresponsive ? Autoscaling group and ELB Health Checks will automatically replace it with new one, without data loss.
Note: The VPC must have enableDnsHostnames
= true
and enableDnsSupport
= true
for the private DNS names to be resolvable for the nodes to connect to each other.
If you can SSH onto one of the nodes you can run:
docker exec rabbitmq rabbitmqctl cluster_status
to see the cluster status of that node.
README.md updated successfully
Name | Version |
---|---|
terraform | >= 0.12 |
aws | >= 3.0 |
Name | Version |
---|---|
aws | >= 3.0 |
random | n/a |
No modules.
Name | Description | Type | Default | Required |
---|---|---|---|---|
access_log_bucket | optional bucket name to use for access logs | string |
"bucketname" |
no |
access_log_bucket_prefix | optional prefix to use for access logs | string |
"" |
no |
access_log_interval | How often for the ELB to publish access logs in minutes | number |
60 |
no |
access_logs_enabled | Whether or not to enable access logging on the ELB | bool |
false |
no |
ami_id | The AMI ID to use for the ec2 instance | string |
"" |
no |
aws_session_manager_enabled | Whether or not the ec2 instances in this cluster should allow session manager permissions | bool |
false |
no |
dd_env | The environment the app is running in | string |
n/a | yes |
dd_site | The Datadog site url | string |
n/a | yes |
desired_size | Desired number of RabbitMQ nodes | number |
2 |
no |
ecr_registry_id | The ECR registry ID | string |
n/a | yes |
elb_additional_security_group_ids | List of additional ELB security group ids | list(string) |
[] |
no |
encrypted_ebs_instance_volume | Whether to encrypt the instance ebs volume | bool |
true |
no |
health_check_grace_period | The ASG health check grace period | number |
400 |
no |
health_check_interval | The ELB health check interval in seconds | number |
30 |
no |
healthy_threshold | The ELB health check healthy threshold count | number |
2 |
no |
instance_type | The EC2 instance type to use | string |
"m5.large" |
no |
instance_volume_iops | The amount of provisioned iops | number |
0 |
no |
instance_volume_size | The size of the instance volume in gigabytes | number |
0 |
no |
instance_volume_type | The instance volume type to use (standard, gp2, gp3, st1, sc1, io1) | string |
"standard" |
no |
kms_key_arn | The KMS key arn to use for encrypting and decrypting SSM parameters | string |
n/a | yes |
max_size | Maximum number of RabbitMQ nodes | number |
2 |
no |
min_size | Minimum number of RabbitMQ nodes | number |
2 |
no |
name | The name of the RabbitMQ cluster | string |
"main" |
no |
nodes_additional_security_group_ids | List of additional node security group ids | list(string) |
[] |
no |
rabbitmq_image | The Rabbitmq docker image | string |
n/a | yes |
session_manager_kms_encryption_enabled | Whether to enable session manager kms encryption to protect session data | bool |
false |
no |
session_manager_kms_key_arn | The kms key arn to use for session manager session encryption | string |
"" |
no |
ssh_key_name | The ssh key to provide the instance to use for ssh login | string |
n/a | yes |
subnet_ids | Subnets for RabbitMQ nodes | list(string) |
n/a | yes |
tags | Optional additional Tags to add onto resources this module creates | map(string) |
{} |
no |
timeout | The ELB health check length of time before timeout in seconds | number |
3 |
no |
unhealthy_threshold | The ELB health check unhealthy threshold count | number |
10 |
no |
vpc_id | n/a | any |
n/a | yes |
Name | Description |
---|---|
admin_password | n/a |
amqp_url | n/a |
rabbit_password | n/a |
rabbitmq_elb_dns | n/a |
secret_cookie | n/a |