class Idlc::Deploy::Config
def get_instance
def get_instance # Get the current instance id from the instance metadata. metadata_endpoint = 'http://169.254.169.254/latest/meta-data/' instance_id = Net::HTTP.get( URI.parse( metadata_endpoint + 'instance-id' ) ) # Create instance object with instance id. instance = Aws::EC2::Instance.new( id: instance_id, region: ENV['AWS_REGION'] ) # save some instance info i = {} i['instance_id'] = instance_id # save tags i['tags'] = {} instance.tags.each do |tag| # Grab all of the tags as node attributes i['tags'][tag.key] = tag.value end i end