sparkle-pack-aws-ecs-amis 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +7 -0
- data/lib/sparkle-pack-aws-ecs-amis.rb +1 -0
- data/lib/sparkleformation/registry/map_ecs_amis.rb +60 -0
- data/sparkle-pack-aws-ecs-amis.gemspec +14 -0
- metadata +90 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 69ede622c8ab6eb3664ed0aaf241a7482bacb6a7
|
4
|
+
data.tar.gz: 131a277636e8ccdfd5cf09331b55b22781b6c640
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: '058d86aa1aa894b00b477569c14e845e40236455094dc186cfb21168b8459971c25953425a9a3b60e43f8138b03cf7bb72af6495071eabd964d2205139204226'
|
7
|
+
data.tar.gz: ff24b92d3ca5f55a15439686634c59581228e82edf5cfe28ce5bef58926b8dd36676e9907fc1f4870d8b743d56d00cf5e0a3e13fe2d073fe6a03f8b4d496f073
|
data/README.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
SparkleFormation::SparklePack.register!
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# http://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-optimized_AMI.html
|
2
|
+
def supported_regions
|
3
|
+
%w[us-east-2 us-east-1
|
4
|
+
us-west-2 us-west-1
|
5
|
+
eu-west-3 eu-west-2 eu-west-1
|
6
|
+
eu-central-1
|
7
|
+
ap-northeast-2 ap-northeast-1
|
8
|
+
ap-southeast-2 ap-southeast-1
|
9
|
+
ca-central-1
|
10
|
+
ap-south-1
|
11
|
+
sa-east-1]
|
12
|
+
end
|
13
|
+
|
14
|
+
def ecs_optimized_linux_ami(region)
|
15
|
+
require 'aws-sdk-core'
|
16
|
+
require 'json'
|
17
|
+
ssm = ::Aws::SSM::Client.new(region: region)
|
18
|
+
result = ssm.get_parameter(name: '/aws/service/ecs/optimized-ami/amazon-linux/recommended')
|
19
|
+
metadata = ::JSON.parse(result.data.parameter.value)
|
20
|
+
metadata['image_id']
|
21
|
+
end
|
22
|
+
|
23
|
+
# Returns a hash like:
|
24
|
+
# ami_hash = {"us-east-2": "ami-64300001",
|
25
|
+
# "us-east-1": "ami-aff65ad2",
|
26
|
+
# "us-west-2": "ami-40ddb938",
|
27
|
+
# "us-west-1": "ami-69677709",
|
28
|
+
# "eu-west-3": "ami-250eb858",
|
29
|
+
# "eu-west-2": "ami-2218f945",
|
30
|
+
# "eu-west-1": "ami-2d386654",
|
31
|
+
# "eu-central-1": "ami-9fc39c74",
|
32
|
+
# "ap-northeast-2": "ami-9d56f9f3",
|
33
|
+
# "ap-northeast-1": "ami-a99d8ad5",
|
34
|
+
# "ap-southeast-2": "ami-efda148d",
|
35
|
+
# "ap-southeast-1": "ami-846144f8",
|
36
|
+
# "ca-central-1": "ami-897ff9ed",
|
37
|
+
# "ap-south-1": "ami-72edc81d",
|
38
|
+
# "sa-east-1": "ami-4a7e2826"
|
39
|
+
# }
|
40
|
+
def amis_to_hash
|
41
|
+
h = {}
|
42
|
+
supported_regions.each do |region|
|
43
|
+
h[region] = ecs_optimized_linux_ami(region)
|
44
|
+
end
|
45
|
+
h
|
46
|
+
end
|
47
|
+
|
48
|
+
# Get latest
|
49
|
+
ami_hash = amis_to_hash
|
50
|
+
|
51
|
+
SfnRegistry.register(:map_ecs_amis) do
|
52
|
+
ami_hash.each do |region, ami|
|
53
|
+
mappings do
|
54
|
+
ecs_ami_map do
|
55
|
+
camel_keys_set!(:auto_disable)
|
56
|
+
set!(region).ami ami
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'sparkle-pack-aws-ecs-amis'
|
3
|
+
s.version = '0.1.0'
|
4
|
+
s.license = 'Apache-2.0'
|
5
|
+
s.summary = 'AWS ECS optimized AMIs'
|
6
|
+
s.description = 'SparklePack to dynamically detect AWS ECS optimized AMIs and provide them as a template mapping'
|
7
|
+
s.author = 'Sean Escriva'
|
8
|
+
s.email = 'sean.escriva@gmail.com'
|
9
|
+
s.homepage = 'https://github.com/webframp/sparkle-pack-aws-ecs-amis'
|
10
|
+
s.files = Dir['lib/sparkleformation/registry/*'] + %w[sparkle-pack-aws-ecs-amis.gemspec lib/sparkle-pack-aws-ecs-amis.rb README.md]
|
11
|
+
s.add_runtime_dependency 'aws-sdk-core', '~> 2.11'
|
12
|
+
s.add_runtime_dependency 'json', '~> 0'
|
13
|
+
s.add_runtime_dependency 'sparkle_formation', '~> 0'
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sparkle-pack-aws-ecs-amis
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sean Escriva
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-05-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: aws-sdk-core
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.11'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.11'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: json
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: sparkle_formation
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: SparklePack to dynamically detect AWS ECS optimized AMIs and provide
|
56
|
+
them as a template mapping
|
57
|
+
email: sean.escriva@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- README.md
|
63
|
+
- lib/sparkle-pack-aws-ecs-amis.rb
|
64
|
+
- lib/sparkleformation/registry/map_ecs_amis.rb
|
65
|
+
- sparkle-pack-aws-ecs-amis.gemspec
|
66
|
+
homepage: https://github.com/webframp/sparkle-pack-aws-ecs-amis
|
67
|
+
licenses:
|
68
|
+
- Apache-2.0
|
69
|
+
metadata: {}
|
70
|
+
post_install_message:
|
71
|
+
rdoc_options: []
|
72
|
+
require_paths:
|
73
|
+
- lib
|
74
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
requirements: []
|
85
|
+
rubyforge_project:
|
86
|
+
rubygems_version: 2.5.2
|
87
|
+
signing_key:
|
88
|
+
specification_version: 4
|
89
|
+
summary: AWS ECS optimized AMIs
|
90
|
+
test_files: []
|