Building a Docker Registry with High Availability on AWS
Build a Highly Available Docker Registry on AWS With Sonatype Nexus Repository
January 04, 2018
By Mohamed Labouardy
10 minute read time
Have you ever wondered how you can build a highly available and resilient Docker Repository to store your Docker Images?
In this article, we will setup an EC2 instance inside a Security Group and create an A record pointing to the server Elastic IP address as follows:
To provision the infrastructure, we will use Terraform as IaC (Infrastructure as Code) tool. The advantage of using this kind of tool is the ability to spin up a new environment quickly in different AWS region (or different IaaS providers) in case of incident (disaster recovery).
Start by cloning the following GitHub repository:
| 1 | git clone https://github.com/mlabouardy/terraform-aws-labs.git |
Inside docker-registry folder, update the variables.tfvars with your own AWS credentials (make sure you have the right IAM policies).
| 1 2 3 4 5 6 7 8 9 10 11 12 |
resource "aws_instance" "default" { ami="${lookup(var.amis, var.region)}" instance_type="${var.instance_type}" key_name="${aws_key_pair.default.id}" security_groups=["${aws_security_group.default.name}"] user_data="${file("setup.sh")}\ |