Class: CfnVpn::Templates::Helper

Inherits:
Object
  • Object
show all
Defined in:
lib/cfnvpn/templates/helper.rb

Class Method Summary collapse

Class Method Details

.get_auth_cidr(region, subnet_id) ⇒ Object



6
7
8
9
10
11
# File 'lib/cfnvpn/templates/helper.rb', line 6

def self.get_auth_cidr(region, subnet_id)
  client = Aws::EC2::Client.new(region: region)
  subnets = client.describe_subnets({subnet_ids:[subnet_id]})
  vpcs = client.describe_vpcs({vpc_ids:[subnets.subnets[0].vpc_id]})
  return vpcs.vpcs[0].cidr_block
end