fboucquez / symbol-bootstrap

A tool that allows you to quickly configure and setup Symbol testnets and nodes.
Apache License 2.0
47 stars 27 forks source link

Auto resolve IP/Hostname from AWS EC2 Instance #156

Open fboucquez opened 3 years ago

fboucquez commented 3 years ago

This feature is to allow users to set up the custom preset with a tag that tells bootstrap to resolve the public IP or hostname of an ec2 node automatically.

Something like:

nodes:
   - host: {{ec2PublicIP}}
nodes:
   - host: {{ec2PublicHostanme}}

By calling the current ec2 instance meta-data:

curl http://169.254.169.254/latest/meta-data/public-ipv4 curl http://169.254.169.254/latest/meta-data/public-hostname

There are some nuances. The instance should have metadata v1 enabled. With metadata v2, it is more secure. SO, you'll need to get a token first.

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html#instancedata-meta-data-retrieval-examples

We could add similar helper functions for other cloud providers.