Site icon TAAGUNG

Consul Set up on EC2 Linux

Latest posts by Ankit Verma (see all)

Consul

Consul is a service networking solution to connect and secure services across any runtime platform and public or private cloud

https://www.consul.io/

Amazon Elastic Cloud Compute (EC2)

Amazon Elastic Compute Cloud (Amazon EC2) is a web service that provides secure, resizable compute capacity in the cloud. It is designed to make web-scale cloud computing easier for developers.

https://aws.amazon.com/ec2/

Steps:

  1. cd /usr/local/bin
  2. sudo wget https://releases.hashicorp.com/consul/<linux_version>/<linux_version>.zip
  3. sudo unzip <linux_version>.zip && sudo rm -rf *.zip
  4. sudo mkdir -p /etc/consul/data/ && sudo chmod 777 /etc/consul/data/
  5. sudo mkdir -p /etc/consul/config/ && sudo chmod 777 config/
  6. Create a config file.
{
  "bootstrap": true,
  "server": true,
  "log_level": "DEBUG",
  "enable_syslog": true,
  "datacenter": "dc1",
  "addresses" : {
      "http": "0.0.0.0"
 },
  "bind_addr": "172.31.43.62",
  "node_name": "172.31.43.62",
  "data_dir": "/etc/consul/data/consul_data",
   "ui": true
}

7. Create a service file.

[ Unit]
Description=Consul Startup process
After=network.target

[Service]
Type=simple
ExecStart=/bin/bash -c '/usr/local/bin/consul agent -config-dir /etc/consul/config/config.json'
TimeoutStartSec=0

[Install]
WantedBy=default.target

8. run by using

Start Services : systemctl start/stop/restart consul.

Just make sure port 8500 must be open to access. Now you are ready for utilizing consul anytime and from anywhere.

Exit mobile version