This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'aws-sdk' | |
# Return only a single running instance with the Name tag specified | |
class EC2Helper | |
def self.GetIdFromName(name) | |
instances = Array.new | |
# Filter the ec2 instances for name and state pending or running | |
ec2 = Aws::EC2::Resource.new(region: ENV['AWS_DEFAULT_REGION']) | |
ec2.instances({filters: [ |