lib/cfgen.rb
#this method prepares the ec2 and sg from template
this method prepares the ec2 and sg from template
this method prepares the ec2 and sg from template
def prepare_ec2(ec2, subnet, vpc, image_ref, ssh_ip, instance_type)
      ec2_new = deep_copy(ec2)
      ec2_new['Resources']["MyEC2Instance"]["Properties"]["ImageId"]["Ref"] = image_ref
      ec2_new['Resources']["MyEC2Instance"]["Properties"]["InstanceType"] = instance_type
      ec2_new['Resources']["MyEC2Instance"]["Properties"]["SubnetId"]["Ref"] = subnet
      ec2_new['Resources']["InstanceSecurityGroup"]["Properties"]["VpcId"]["Ref"] = vpc
      ec2_new['Resources']["InstanceSecurityGroup"]["Properties"]["SecurityGroupIngress"][0]["CidrIp"] = ssh_ip
      ec2_new
    end
def prepare_ec2 ( ec2 , subnet , vpc , image_ref , ssh_ip , instance_type ) ec2_new = deep_copy ( ec2 ) ec2_new [ 'Resources' ] [ "MyEC2Instance" ] [ "Properties" ] [ "ImageId" ] [ "Ref" ] = image_ref ec2_new [ 'Resources' ] [ "MyEC2Instance" ] [ "Properties" ] [ "InstanceType" ] = instance_type ec2_new [ 'Resources' ] [ "MyEC2Instance" ] [ "Properties" ] [ "SubnetId" ] [ "Ref" ] = subnet ec2_new [ 'Resources' ] [ "InstanceSecurityGroup" ] [ "Properties" ] [ "VpcId" ] [ "Ref" ] = vpc ec2_new [ 'Resources' ] [ "InstanceSecurityGroup" ] [ "Properties" ] [ "SecurityGroupIngress" ] [ 0 ] [ "CidrIp" ] = ssh_ip ec2_new end
this method prepares the ec2 and sg from template
this method prepares the ec2 and sg from template
#ec2_old = deep_copy(ec2['Resources']['MyEC2Instance']) #assign the values accordingly
ec2
subnet
vpc
image_ref
ssh_ip
instance_type