I have created a Swarm and consule. After that i tried to do below comment but i am having doubt that what is a and b in the comment mentioned.
"Now we can configure our new Swarm agents on each host a and b:
$ docker run -d --restart=always --name swarm-agent-consul swarm:1.0.0 join --advertise $(curl http://169.254.169.254/latest/meta-data/public-ipv4):2376 consul://126.96.36.199:8500"
Also when i used this command i am getting error as mentioned below: