Sha256: c53c20a12788dfd58e2fc00d871c98f24d9c2bb935bbeb9f52771d2e9a7d52e8
Contents?: true
Size: 806 Bytes
Versions: 15
Compression:
Stored size: 806 Bytes
Contents
module Lono::Template::Strategy::Dsl::Builder::Helpers module Ec2Helper extend Memoist def default_vpc resp = ec2.describe_vpcs(filters: [name: "isDefault", values: ["true"]]) vpc = resp.vpcs.first vpc ? vpc.vpc_id : "no default vpc found" end memoize :default_vpc def default_subnets return "no default subnets because no default vpc found" if default_vpc == "no default vpc found" resp = ec2.describe_subnets(filters: [name: "vpc-id", values: [default_vpc]]) subnets = resp.subnets subnets.map(&:subnet_id) end memoize :default_subnets def key_pairs(regexp=nil) resp = ec2.describe_key_pairs key_names = resp.key_pairs.map(&:key_name) key_names.select! { |k| k =~ regexp } key_names end end end
Version data entries
15 entries across 15 versions & 1 rubygems