Sha256: 46ce7fd73e640b4f3ee827f3a0e65e8a2661ad8ba48605a59b18e667a5cd9328

Contents?: true

Size: 1.22 KB

Versions: 3

Compression:

Stored size: 1.22 KB

Contents

module Kontena
  module Machine
    module Aws
      module Common

        # @param [String] region
        # @return String
        def resolve_ami(region)
          images = {
              'eu-central-1' => 'ami-fee2fb92',
              'ap-northeast-1' => 'ami-26033d48',
              'us-gov-west-1' => 'ami-bdf04cdc',
              'sa-east-1' => 'ami-10c5457c',
              'ap-southeast-2' => 'ami-dc8baebf',
              'ap-southeast-1' => 'ami-6969a50a',
              'us-east-1' => 'ami-23260749',
              'us-west-2' => 'ami-20927640',
              'us-west-1' => 'ami-c2e490a2',
              'eu-west-1' => 'ami-7e72c70d'
          }
          images[region]
        end

        # @param [String] vpc_id
        # @param [String] zone
        # @return [Aws::EC2::Types::Subnet, NilClass]
        def default_subnet(vpc_id, zone)
          ec2.subnets({
            filters: [
              {name: "vpc-id", values: [vpc_id]},
              {name: "availability-zone", values: [zone]}
            ]
          }).first
        end

        # @return [Aws::EC2::Types::Vpc, NilClass]
        def default_vpc
          ec2.vpcs({filters: [{name: "is-default", values: ["true"]}]}).first
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kontena-cli-0.12.3 lib/kontena/machine/aws/common.rb
kontena-cli-0.12.2 lib/kontena/machine/aws/common.rb
kontena-cli-0.12.1 lib/kontena/machine/aws/common.rb