kitchen-ec2 2.2.2 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/kitchen/driver/ec2.rb +6 -2
- data/lib/kitchen/driver/ec2_version.rb +1 -1
- metadata +4 -24
- data/.gitignore +0 -22
- data/.rspec +0 -3
- data/.travis.yml +0 -21
- data/.yardopts +0 -3
- data/Gemfile +0 -16
- data/README.md +0 -497
- data/Rakefile +0 -43
- data/kitchen-ec2.gemspec +0 -40
- data/spec/kitchen/driver/ec2/client_spec.rb +0 -66
- data/spec/kitchen/driver/ec2/image_selection_spec.rb +0 -371
- data/spec/kitchen/driver/ec2/instance_generator_spec.rb +0 -612
- data/spec/kitchen/driver/ec2_spec.rb +0 -797
- data/spec/spec_helper.rb +0 -107
- data/spec/support/fake_image.rb +0 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c73450f0974fff7368bd5e8d479b70fdd1513942023e41b0eea948249a53606b
|
4
|
+
data.tar.gz: 5e680d5c74137028c7664f5ff20a6a349d43d79635fff5dec5c3f433bfd82600
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c62b63a7ac1b025aa4182437427d9f3d2e1ff409899de494a90e831fe0cf90fcdabf0f93cb530a9ad04ce534c3ee306f111866d05b2ec35a5ad9035008494a2
|
7
|
+
data.tar.gz: f6a4d1dabd28abbd1878d04ac5fc083703c8dbc521fe08ad97e640d7b95253d7d87f63c4359482303d4564025b68048c21296ed22d536e4c6a1c9431ec94b6b9
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [v2.3.0](https://github.com/test-kitchen/kitchen-ec2/tree/v2.3.0) (2018-10-05)
|
4
|
+
[Full Changelog](https://github.com/test-kitchen/kitchen-ec2/compare/v2.2.2...v2.3.0)
|
5
|
+
|
6
|
+
- Add port 3389 (RDP) to the automatically generated security group
|
7
|
+
- Fix logfile creation on Windows to not fail if the directory doesn't exist
|
8
|
+
- The gem no longer ships with test deps so we can slim the install size
|
9
|
+
|
3
10
|
## [v2.2.2](https://github.com/test-kitchen/kitchen-ec2/tree/v2.2.2) (2018-06-11)
|
4
11
|
[Full Changelog](https://github.com/test-kitchen/kitchen-ec2/compare/v2.2.1...v2.2.2)
|
5
12
|
|
data/lib/kitchen/driver/ec2.rb
CHANGED
@@ -641,7 +641,11 @@ module Kitchen
|
|
641
641
|
Else
|
642
642
|
{
|
643
643
|
$logfile='C:\\Program Files\\Amazon\\Ec2ConfigService\\Logs\\kitchen-ec2.log'
|
644
|
-
|
644
|
+
}
|
645
|
+
|
646
|
+
# Logfile fail-safe in case the directory does not exist
|
647
|
+
New-Item $logfile -Force
|
648
|
+
|
645
649
|
# Allow script execution
|
646
650
|
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force
|
647
651
|
#PS Remoting and & winrm.cmd basic config
|
@@ -750,7 +754,7 @@ module Kitchen
|
|
750
754
|
ec2.client.authorize_security_group_ingress(
|
751
755
|
group_id: state[:auto_security_group_id],
|
752
756
|
# Allow SSH and WinRM (both plain and TLS).
|
753
|
-
ip_permissions: [22, 5985, 5986].map do |port|
|
757
|
+
ip_permissions: [22, 3389, 5985, 5986].map do |port|
|
754
758
|
{
|
755
759
|
ip_protocol: "tcp",
|
756
760
|
from_port: port,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kitchen-ec2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fletcher Nichol
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-kitchen
|
@@ -197,16 +197,8 @@ executables: []
|
|
197
197
|
extensions: []
|
198
198
|
extra_rdoc_files: []
|
199
199
|
files:
|
200
|
-
- ".gitignore"
|
201
|
-
- ".rspec"
|
202
|
-
- ".travis.yml"
|
203
|
-
- ".yardopts"
|
204
200
|
- CHANGELOG.md
|
205
|
-
- Gemfile
|
206
201
|
- LICENSE
|
207
|
-
- README.md
|
208
|
-
- Rakefile
|
209
|
-
- kitchen-ec2.gemspec
|
210
202
|
- lib/kitchen/driver/aws/client.rb
|
211
203
|
- lib/kitchen/driver/aws/instance_generator.rb
|
212
204
|
- lib/kitchen/driver/aws/standard_platform.rb
|
@@ -220,15 +212,9 @@ files:
|
|
220
212
|
- lib/kitchen/driver/aws/standard_platform/windows.rb
|
221
213
|
- lib/kitchen/driver/ec2.rb
|
222
214
|
- lib/kitchen/driver/ec2_version.rb
|
223
|
-
- spec/kitchen/driver/ec2/client_spec.rb
|
224
|
-
- spec/kitchen/driver/ec2/image_selection_spec.rb
|
225
|
-
- spec/kitchen/driver/ec2/instance_generator_spec.rb
|
226
|
-
- spec/kitchen/driver/ec2_spec.rb
|
227
|
-
- spec/spec_helper.rb
|
228
|
-
- spec/support/fake_image.rb
|
229
215
|
homepage: https://kitchen.ci/
|
230
216
|
licenses:
|
231
|
-
- Apache
|
217
|
+
- Apache-2.0
|
232
218
|
metadata: {}
|
233
219
|
post_install_message:
|
234
220
|
rdoc_options: []
|
@@ -250,10 +236,4 @@ rubygems_version: 2.7.6
|
|
250
236
|
signing_key:
|
251
237
|
specification_version: 4
|
252
238
|
summary: A Test Kitchen Driver for Amazon EC2
|
253
|
-
test_files:
|
254
|
-
- spec/kitchen/driver/ec2/client_spec.rb
|
255
|
-
- spec/kitchen/driver/ec2/image_selection_spec.rb
|
256
|
-
- spec/kitchen/driver/ec2/instance_generator_spec.rb
|
257
|
-
- spec/kitchen/driver/ec2_spec.rb
|
258
|
-
- spec/spec_helper.rb
|
259
|
-
- spec/support/fake_image.rb
|
239
|
+
test_files: []
|
data/.gitignore
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
*.gem
|
2
|
-
*.rbc
|
3
|
-
.bundle
|
4
|
-
.config
|
5
|
-
.yardoc
|
6
|
-
Gemfile.lock
|
7
|
-
InstalledFiles
|
8
|
-
_yardoc
|
9
|
-
coverage
|
10
|
-
bin/
|
11
|
-
doc/
|
12
|
-
lib/bundler/man
|
13
|
-
pkg
|
14
|
-
rdoc
|
15
|
-
spec/reports
|
16
|
-
test/tmp
|
17
|
-
test/version_tmp
|
18
|
-
tmp
|
19
|
-
.project
|
20
|
-
|
21
|
-
.kitchen/
|
22
|
-
.kitchen.local.yml
|
data/.rspec
DELETED
data/.travis.yml
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
cache: bundler
|
3
|
-
sudo: false
|
4
|
-
branches:
|
5
|
-
only:
|
6
|
-
- master
|
7
|
-
rvm:
|
8
|
-
- 2.3.6
|
9
|
-
- 2.4.3
|
10
|
-
|
11
|
-
# https://github.com/travis-ci/travis-ci/issues/8978
|
12
|
-
matrix:
|
13
|
-
include:
|
14
|
-
- rvm: 2.5.0
|
15
|
-
before_install:
|
16
|
-
- gem update --system
|
17
|
-
- rvm: ruby-head
|
18
|
-
before_install:
|
19
|
-
- gem update --system
|
20
|
-
allow_failures:
|
21
|
-
- rvm: ruby-head
|
data/.yardopts
DELETED
data/Gemfile
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
source "https://rubygems.org"
|
2
|
-
|
3
|
-
# Specify your gem"s dependencies in kitchen-ec2.gemspec
|
4
|
-
gemspec
|
5
|
-
|
6
|
-
gem "winrm-transport"
|
7
|
-
gem "winrm-fs"
|
8
|
-
|
9
|
-
group :test do
|
10
|
-
gem "rake"
|
11
|
-
gem "pry"
|
12
|
-
end
|
13
|
-
|
14
|
-
group :changelog do
|
15
|
-
gem "github_changelog_generator"
|
16
|
-
end
|
data/README.md
DELETED
@@ -1,497 +0,0 @@
|
|
1
|
-
# <a name="title"></a> Kitchen::Ec2: A Test Kitchen Driver for Amazon EC2
|
2
|
-
|
3
|
-
[![Gem Version](https://badge.fury.io/rb/kitchen-ec2.svg)](https://badge.fury.io/rb/kitchen-ec2)
|
4
|
-
[![Build Status](https://travis-ci.org/test-kitchen/kitchen-ec2.svg?branch=master)](https://travis-ci.org/test-kitchen/kitchen-ec2)
|
5
|
-
[![Code Climate](https://codeclimate.com/github/test-kitchen/kitchen-ec2/badges/gpa.svg)](https://codeclimate.com/github/test-kitchen/kitchen-ec2)
|
6
|
-
|
7
|
-
A [Test Kitchen][kitchenci] Driver for Amazon EC2.
|
8
|
-
|
9
|
-
This driver uses the [aws sdk gem][aws_sdk_gem] to provision and destroy EC2
|
10
|
-
instances. Use Amazon's cloud for your infrastructure testing!
|
11
|
-
|
12
|
-
## Quick Start
|
13
|
-
|
14
|
-
1. Install [ChefDK](https://downloads.chef.io/chefdk). If testing things other
|
15
|
-
than Chef cookbooks, please consult your driver's documentation for information
|
16
|
-
on what to install.
|
17
|
-
2. Install the [AWS command line tools](https://docs.aws.amazon.com/cli/latest/userguide/installing.html).
|
18
|
-
3. Run `aws configure`. This will set up your AWS credentials for both the AWS
|
19
|
-
CLI tools and kitchen-ec2.
|
20
|
-
4. Add or exit the `driver` section of your `.kitchen.yml`:
|
21
|
-
|
22
|
-
```yaml
|
23
|
-
driver:
|
24
|
-
name: ec2
|
25
|
-
```
|
26
|
-
5. Run `kitchen test`.
|
27
|
-
|
28
|
-
## Requirements
|
29
|
-
|
30
|
-
There are **no** external system requirements for this driver. However you
|
31
|
-
will need access to an [AWS][aws_site] account. [IAM][iam_site] users should have, at a minimum, permission to manage the lifecycle of an EC2 instance along with modifying components specified in kitchen driver configs. Consider using a permissive managed IAM policy like ``arn:aws:iam::aws:policy/AmazonEC2FullAccess`` or tailor one specific to your security requirements.
|
32
|
-
|
33
|
-
## Configuration
|
34
|
-
|
35
|
-
By automatically applying reasonable defaults wherever possible, kitchen-ec2 does a lot of work to make your life easier. Here is a description of some of the configuration parameters and what we do to default them.
|
36
|
-
|
37
|
-
### Specifying the Image
|
38
|
-
|
39
|
-
There are three ways to specify the image you use for the instance: the `platform`
|
40
|
-
name, `image_id`, and `image_search`.
|
41
|
-
|
42
|
-
#### `platform` Name
|
43
|
-
|
44
|
-
The third way to specify the image is by leaving `image_id` and `image_search`
|
45
|
-
blank, and specifying a standard platform name.
|
46
|
-
|
47
|
-
```yaml
|
48
|
-
platforms:
|
49
|
-
- name: ubuntu-14.04
|
50
|
-
```
|
51
|
-
|
52
|
-
If you use the platform name `ubuntu`, `windows`, `rhel`, `debian`, `centos`, `freebsd` or `fedora`, kitchen-ec2 will search for the latest matching official image of
|
53
|
-
the given OS in your region. You may leave versions off, specify partial versions,
|
54
|
-
and you may specify architecture to distinguish 32- and 64-bit. Some examples:
|
55
|
-
|
56
|
-
```yaml
|
57
|
-
platforms:
|
58
|
-
# The latest stable minor+patch release of rhel 6
|
59
|
-
- name: rhel-6
|
60
|
-
# The latest patch release of CentOS 6.3
|
61
|
-
- name: centos-6.3
|
62
|
-
# The latest patch release of Amazon Linux 2017.03
|
63
|
-
- name: amazon-2017.03
|
64
|
-
# 32-bit version of latest major+minor+patch release of Ubuntu
|
65
|
-
- name: ubuntu-i386
|
66
|
-
# 32-bit version of Debian 6
|
67
|
-
- name: debian-6-i386
|
68
|
-
# Latest 32-bit stable minor release of freebsd 10
|
69
|
-
- name: freebsd-10-i386
|
70
|
-
# The latest stable major+minor+patch release of Fedora
|
71
|
-
- name: fedora
|
72
|
-
# The most recent service-pack for Windows 2012 (not R2)
|
73
|
-
- name: windows-2012
|
74
|
-
# The most recent service-pack for Windows 2012R2
|
75
|
-
- name: windows-2012r2
|
76
|
-
# Windows 2008 RTM (not R2, no service pack)
|
77
|
-
- name: windows-2008rtm
|
78
|
-
# Windows 2008R2 SP1
|
79
|
-
- name: windows-2008r2sp1
|
80
|
-
```
|
81
|
-
|
82
|
-
We always pick the highest released stable version that matches your regex, and
|
83
|
-
follow the other `image_search` rules for preference.
|
84
|
-
|
85
|
-
#### `image_id`
|
86
|
-
|
87
|
-
`image_id` can be set explicitly. It must be an ami in the region you are
|
88
|
-
working with!
|
89
|
-
|
90
|
-
```yaml
|
91
|
-
platforms:
|
92
|
-
- name: centos-7
|
93
|
-
driver:
|
94
|
-
image_id: ami-96a818fe
|
95
|
-
```
|
96
|
-
|
97
|
-
image_id's have a format like ami-748e2903. The image_id values appear next to the image names when you select 'Launch Instance' from the AWS EC2 console. You can also see the list from the AWS CLI ````aws ec2 describe-images````.
|
98
|
-
|
99
|
-
#### `image_search`
|
100
|
-
|
101
|
-
`image_search` lets you specify a series of key/value pairs to search for the
|
102
|
-
image. If a value is set to an array, then *any* of those values will match.
|
103
|
-
You can learn more about the available filters in the AWS CLI doc under `--filters` [here](http://docs.aws.amazon.com/cli/latest/reference/ec2/describe-images.html).
|
104
|
-
|
105
|
-
```yaml
|
106
|
-
platforms:
|
107
|
-
- name: ubuntu-14.04
|
108
|
-
driver:
|
109
|
-
image_search:
|
110
|
-
owner-id: "099720109477"
|
111
|
-
name: ubuntu/images/*/ubuntu-*-14.04*
|
112
|
-
```
|
113
|
-
|
114
|
-
In the event that there are multiple matches (as sometimes happens), we sort to
|
115
|
-
get the best results. In order of priority from greatest to least, we prefer:
|
116
|
-
|
117
|
-
- HVM images over paravirtual
|
118
|
-
- SSD support over magnetic drives
|
119
|
-
- 64-bit over 32-bit
|
120
|
-
- The most recently created image (to pick up patch releases)
|
121
|
-
|
122
|
-
Note that the image_search method *requires* that the AMI image names be in a specific format.
|
123
|
-
Some examples are:
|
124
|
-
|
125
|
-
- Windows-2012
|
126
|
-
- Windows-2012r2
|
127
|
-
- Windows-2012r2sp1
|
128
|
-
- RHEL-7.2
|
129
|
-
|
130
|
-
It is safest to use the same naming convention as used by the public images published by the OS vendors on the AWS marketplace.
|
131
|
-
|
132
|
-
### AWS Authentication
|
133
|
-
|
134
|
-
In order to connect to AWS, you must specify AWS credentials. We rely on the SDK
|
135
|
-
to find credentials in the standard way, documented here:
|
136
|
-
https://github.com/aws/aws-sdk-ruby/#configuration
|
137
|
-
|
138
|
-
The SDK Chain will search environment variables, then config files, then IAM role
|
139
|
-
data from the instance profile, in that order. In the case config files being
|
140
|
-
present, the 'default' profile will be used unless `shared_credentials_profile`
|
141
|
-
is defined to point to another profile.
|
142
|
-
|
143
|
-
Because the Test Kitchen test should be checked into source control and ran
|
144
|
-
through CI we no longer support storing the AWS credentials in the
|
145
|
-
`.kitchen.yml` file.
|
146
|
-
|
147
|
-
### Instance Login Configuration
|
148
|
-
|
149
|
-
The instances you create use credentials you specify which are *separate* from
|
150
|
-
the AWS credentials. Generally, SSH and WinRM use an AWS key pair which you
|
151
|
-
specify.
|
152
|
-
|
153
|
-
#### SSH
|
154
|
-
|
155
|
-
The `aws_ssh_key_id` value is the name of the AWS key pair you want to use.
|
156
|
-
|
157
|
-
The value can be one of:
|
158
|
-
|
159
|
-
* `nil` (default)
|
160
|
-
|
161
|
-
By default the key ID is read from the `AWS_SSH_KEY_ID` environment variable. If the environment variable is not set, the value will be nil. In this case, a temporary key will be created for you (**>= 2.1.0**).
|
162
|
-
|
163
|
-
* `name_of_some_existing_aws_key_pair`
|
164
|
-
|
165
|
-
By setting the environment variable `AWS_SSH_KEY_ID` or by setting the `aws_ssh_key_id` driver option in kitchen.yml. This will be the key that becomes associated with the test EC2 instances. The key must already exist in AWS. To see a list of existing key pair IDs in a region, use the `aws` CLI tool. For example, in the US-East-1 region: `aws ec2 describe-key-pairs --region us-east-1`.
|
166
|
-
|
167
|
-
* `_disable`
|
168
|
-
|
169
|
-
This will not directly associate the EC2 instance with an AWS-managed key pair (pre-existing or auto-generated). This may be useful in environments that have disabled AWS-managed keys. Getting SSH keys onto the instance then becomes an exercise for the reader, though it can be done, for example, with scripting in `user_data` or if the credentials are already baked into the AMI.
|
170
|
-
|
171
|
-
When using an existing key, either an AWS-managed key pair or keys that exist on the instance through some other means, ensure that the private key is configured in your Test Kitchen `transport` section, either directly or made available via `ssh-agent`:
|
172
|
-
|
173
|
-
```yaml
|
174
|
-
transport:
|
175
|
-
ssh_key: ~/.ssh/mykey.pem
|
176
|
-
```
|
177
|
-
|
178
|
-
For standard platforms we automatically provide the SSH username, but when specifying your own AMI you may need to configure that as well.
|
179
|
-
|
180
|
-
#### WinRM
|
181
|
-
|
182
|
-
For Windows instances the generated Administrator password is fetched automatically from Amazon EC2 with the same private key as we use for SSH.
|
183
|
-
|
184
|
-
Unfortunately the RDP file format does not allow including login credentials, so `kitchen login` with WinRM cannot automatically log in for you.
|
185
|
-
|
186
|
-
### Other Configuration
|
187
|
-
|
188
|
-
#### `availability_zone`
|
189
|
-
|
190
|
-
The AWS [availability zone][region_docs] to use. Only request
|
191
|
-
the letter designation - will attach this to the region used.
|
192
|
-
|
193
|
-
If not specified, your instances will be placed in an AZ of AWS's choice in your
|
194
|
-
region.
|
195
|
-
|
196
|
-
#### `instance_type`
|
197
|
-
|
198
|
-
The EC2 [instance type][instance_docs] (also known as size) to use.
|
199
|
-
|
200
|
-
The default is `t2.micro` or `t1.micro`, depending on whether the image is `hvm`
|
201
|
-
or `paravirtual`. (`paravirtual` images are incompatible with `t2.micro`.)
|
202
|
-
|
203
|
-
#### `security_group_ids`
|
204
|
-
|
205
|
-
An Array of EC2 [security groups][group_docs] which will be applied to the
|
206
|
-
instance. If no security group is specified, a temporary group will be created
|
207
|
-
automatically which allows SSH and WinRM (**>= 2.1.0**).
|
208
|
-
|
209
|
-
#### `security_group_filter`
|
210
|
-
|
211
|
-
The EC2 [security group][group_docs] which will be applied to the instance,
|
212
|
-
specified by tag. Only one group can be specified this way.
|
213
|
-
|
214
|
-
The default is unset, or `nil`.
|
215
|
-
|
216
|
-
An example of usage:
|
217
|
-
```yaml
|
218
|
-
security_group_filter:
|
219
|
-
tag: 'Name'
|
220
|
-
value: 'example-group-name'
|
221
|
-
```
|
222
|
-
|
223
|
-
#### `region`
|
224
|
-
|
225
|
-
**Required** The AWS [region][region_docs] to use.
|
226
|
-
|
227
|
-
If the environment variable `AWS_REGION` is populated that will be used.
|
228
|
-
Otherwise the default is `"us-east-1"`.
|
229
|
-
|
230
|
-
#### `subnet_id`
|
231
|
-
|
232
|
-
The EC2 [subnet][subnet_docs] to use.
|
233
|
-
|
234
|
-
The default is unset, or `nil`.
|
235
|
-
|
236
|
-
#### `subnet_filter`
|
237
|
-
|
238
|
-
The EC2 [subnet][subnet_docs] to use, specified by tag.
|
239
|
-
|
240
|
-
The default is unset, or `nil`.
|
241
|
-
|
242
|
-
An example of usage:
|
243
|
-
```yaml
|
244
|
-
subnet_filter:
|
245
|
-
tag: 'Name'
|
246
|
-
value: 'example-subnet-name'
|
247
|
-
```
|
248
|
-
|
249
|
-
#### `tags`
|
250
|
-
|
251
|
-
The Hash of EC tag name/value pairs which will be applied to the instance.
|
252
|
-
|
253
|
-
The default is `{ "created-by" => "test-kitchen" }`.
|
254
|
-
|
255
|
-
#### `user_data`
|
256
|
-
|
257
|
-
The user_data script or the path to a script to feed the instance.
|
258
|
-
Use bash to install dependencies or download artifacts before chef runs.
|
259
|
-
This is just for some cases. If you can do the stuff with chef, then do it with
|
260
|
-
chef!
|
261
|
-
|
262
|
-
On linux instances the default is unset, or `nil`.
|
263
|
-
|
264
|
-
On Windows instances we specify a default that enables winrm and
|
265
|
-
adds a non-administrator user specified in the `username` transport
|
266
|
-
options to the Administrator's User Group.
|
267
|
-
|
268
|
-
#### `iam_profile_name`
|
269
|
-
|
270
|
-
The EC2 IAM profile name to use. The default is `nil`.
|
271
|
-
|
272
|
-
Note: The user, whose AWS credentials you have defined, not only needs `AmazonEC2FullAccess` permissions, but also the ability to execute `iam:PassRole`.
|
273
|
-
Hence, use a policy like below when using this option:
|
274
|
-
```json
|
275
|
-
{
|
276
|
-
"Version": "2012-10-17",
|
277
|
-
"Statement": [
|
278
|
-
{
|
279
|
-
"Effect": "Allow",
|
280
|
-
"Action": [
|
281
|
-
"ec2:*"
|
282
|
-
],
|
283
|
-
"Resource": "*"
|
284
|
-
},
|
285
|
-
{
|
286
|
-
"Effect": "Allow",
|
287
|
-
"Action": "iam:PassRole",
|
288
|
-
"Resource": "arn:aws:iam::123456789:role/RoleName"
|
289
|
-
}
|
290
|
-
]
|
291
|
-
}
|
292
|
-
```
|
293
|
-
|
294
|
-
See [AWS documentation](https://aws.amazon.com/de/blogs/security/granting-permission-to-launch-ec2-instances-with-iam-roles-passrole-permission/) for more details.
|
295
|
-
|
296
|
-
|
297
|
-
#### `spot_price`
|
298
|
-
|
299
|
-
The price you bid in order to submit a spot request. An additional step will be required during the spot request process submission. If no price is set, it will use an on-demand instance.
|
300
|
-
|
301
|
-
The default is `nil`.
|
302
|
-
|
303
|
-
#### `instance_initiated_shutdown_behavior`
|
304
|
-
|
305
|
-
Control whether an instance should `stop` or `terminate` when shutdown is initiated from the instance using an operating system command for system shutdown.
|
306
|
-
|
307
|
-
The default is `nil`.
|
308
|
-
|
309
|
-
#### `block_duration_minutes`
|
310
|
-
|
311
|
-
The [specified duration](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-requests.html#fixed-duration-spot-instances) for a spot instance, in minutes. This value must be a multiple of 60 (60, 120, 180, 240, 300, or 360).
|
312
|
-
If no duration is set, the spot instance will remain active until it is terminated.
|
313
|
-
|
314
|
-
The default is `nil`.
|
315
|
-
|
316
|
-
#### `http_proxy`
|
317
|
-
|
318
|
-
Specify a proxy to send AWS requests through. Should be of the format `http://<host>:<port>`.
|
319
|
-
|
320
|
-
The default is `ENV["HTTPS_PROXY"] || ENV["HTTP_PROXY"]`. If you have these environment variables set and do not want to use a proxy when contacting aws set `http_proxy: nil`.
|
321
|
-
|
322
|
-
**Note** - The AWS command line utility allow you to specify [two proxies](http://docs.aws.amazon.com/cli/latest/userguide/cli-http-proxy.html), one for HTTP and one for HTTPS. The AWS Ruby SDK only allows you to specify 1 proxy and because all requests are `https://` this proxy needs to support HTTPS.
|
323
|
-
|
324
|
-
#### `ssl_verify_peer`
|
325
|
-
|
326
|
-
If you need to turn off ssl certificate verification for HTTP calls made to AWS, set `ssl_verify_peer: false`.
|
327
|
-
|
328
|
-
### Disk Configuration
|
329
|
-
|
330
|
-
#### <a name="config-block_device_mappings"></a> `block_device_mappings`
|
331
|
-
|
332
|
-
A list of block device mappings for the machine. An example of all available keys looks like:
|
333
|
-
```yaml
|
334
|
-
block_device_mappings:
|
335
|
-
- device_name: /dev/sda
|
336
|
-
ebs:
|
337
|
-
volume_size: 20
|
338
|
-
delete_on_termination: true
|
339
|
-
- device_name: /dev/sdb
|
340
|
-
ebs:
|
341
|
-
volume_type: gp2
|
342
|
-
virtual_name: test
|
343
|
-
volume_size: 15
|
344
|
-
delete_on_termination: true
|
345
|
-
snapshot_id: snap-0015d0bc
|
346
|
-
- device_name: /dev/sdc
|
347
|
-
ebs:
|
348
|
-
volume_size: 100
|
349
|
-
delete_on_termination: true
|
350
|
-
volume_type: io1
|
351
|
-
iops: 100
|
352
|
-
```
|
353
|
-
|
354
|
-
See
|
355
|
-
[Amazon EBS Volume Types](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html)
|
356
|
-
to find out more about volume types.
|
357
|
-
|
358
|
-
If you have a block device mapping with a `device_name` equal to the root storage device name on your
|
359
|
-
[image](#config-image-id) then the provided mapping will replace the settings in the image.
|
360
|
-
|
361
|
-
If this is not provided it will use the default block_device_mappings from the AMI.
|
362
|
-
|
363
|
-
#### `ebs_optimized`
|
364
|
-
|
365
|
-
Option to launch EC2 instance with optimized EBS volume. See
|
366
|
-
[Amazon EC2 Instance Types](http://aws.amazon.com/ec2/instance-types/) to find
|
367
|
-
out more about instance types that can be launched as EBS-optimized instances.
|
368
|
-
|
369
|
-
The default is `false`.
|
370
|
-
|
371
|
-
### Network and Communication Configuration
|
372
|
-
|
373
|
-
#### `associate_public_ip`
|
374
|
-
|
375
|
-
AWS does not automatically allocate public IP addresses for instances created
|
376
|
-
within non-default [subnets][subnet_docs]. Set this option to `true` to force
|
377
|
-
allocation of a public IP and associate it with the launched instance.
|
378
|
-
|
379
|
-
If you set this option to `false` when launching into a non-default
|
380
|
-
[subnet][subnet_docs], Test Kitchen will be unable to communicate with the
|
381
|
-
instance unless you have a VPN connection to your
|
382
|
-
[Virtual Private Cloud][vpc_docs].
|
383
|
-
|
384
|
-
The default is `true` if you have configured a [subnet_id](#config-subnet-id),
|
385
|
-
or `false` otherwise.
|
386
|
-
|
387
|
-
#### `private_ip_address`
|
388
|
-
|
389
|
-
The primary private IP address of your instance.
|
390
|
-
|
391
|
-
If you don't set this it will default to whatever DHCP address EC2 hands out.
|
392
|
-
|
393
|
-
#### `interface`
|
394
|
-
|
395
|
-
The place from which to derive the hostname for communicating with the instance. May be `dns`, `public`, `private` or `private_dns`. If this is unset, the driver will derive the hostname by failing back in the following order:
|
396
|
-
|
397
|
-
1. DNS Name
|
398
|
-
2. Public IP Address
|
399
|
-
3. Private IP Address
|
400
|
-
4. Private DNS Name
|
401
|
-
|
402
|
-
The default is unset. Under normal circumstances, the lookup will return the `Private IP Address`.
|
403
|
-
|
404
|
-
If the `Private DNS Name` is preferred over the private IP, it must be specified in the `.kitchen.yml` file
|
405
|
-
|
406
|
-
```ruby
|
407
|
-
driver:
|
408
|
-
interface: private_dns
|
409
|
-
```
|
410
|
-
|
411
|
-
## Example
|
412
|
-
|
413
|
-
The following could be used in a `.kitchen.yml` or in a `.kitchen.local.yml`
|
414
|
-
to override default configuration.
|
415
|
-
|
416
|
-
```yaml
|
417
|
-
---
|
418
|
-
driver:
|
419
|
-
name: ec2
|
420
|
-
aws_ssh_key_id: id_rsa-aws
|
421
|
-
security_group_ids: ["sg-1a2b3c4d"]
|
422
|
-
region: us-west-2
|
423
|
-
availability_zone: b
|
424
|
-
require_chef_omnibus: true
|
425
|
-
subnet_id: subnet-6e5d4c3b
|
426
|
-
iam_profile_name: chef-client
|
427
|
-
instance_type: m3.medium
|
428
|
-
associate_public_ip: true
|
429
|
-
interface: dns
|
430
|
-
|
431
|
-
transport:
|
432
|
-
ssh_key: /path/to/id_rsa-aws
|
433
|
-
connection_timeout: 10
|
434
|
-
connection_retries: 5
|
435
|
-
username: ubuntu
|
436
|
-
|
437
|
-
platforms:
|
438
|
-
- name: ubuntu-16.04
|
439
|
-
- name: centos-6.9
|
440
|
-
- name: centos-7
|
441
|
-
driver:
|
442
|
-
image_id: ami-c7d092f7
|
443
|
-
block_device_mappings:
|
444
|
-
- device_name: /dev/sdb
|
445
|
-
ebs:
|
446
|
-
volume_type: gp2
|
447
|
-
virtual_name: test
|
448
|
-
volume_size: 8
|
449
|
-
delete_on_termination: true
|
450
|
-
transport:
|
451
|
-
username: centos
|
452
|
-
- name: windows-2012r2
|
453
|
-
- name: windows-2016
|
454
|
-
|
455
|
-
suites:
|
456
|
-
# ...
|
457
|
-
```
|
458
|
-
|
459
|
-
## <a name="development"></a> Development
|
460
|
-
|
461
|
-
* Source hosted at [GitHub][repo]
|
462
|
-
* Report issues/questions/feature requests on [GitHub Issues][issues]
|
463
|
-
|
464
|
-
Pull requests are very welcome! Make sure your patches are well tested.
|
465
|
-
Ideally create a topic branch for every separate change you make. For
|
466
|
-
example:
|
467
|
-
|
468
|
-
1. Fork the repo
|
469
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
470
|
-
3. Commit your changes (`git commit -am 'Added some feature'`)
|
471
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
472
|
-
5. Create new Pull Request
|
473
|
-
|
474
|
-
## <a name="license"></a> License
|
475
|
-
|
476
|
-
Apache 2.0 (see [LICENSE][license])
|
477
|
-
|
478
|
-
|
479
|
-
[author]: https://github.com/fnichol
|
480
|
-
[issues]: https://github.com/test-kitchen/kitchen-ec2/issues
|
481
|
-
[license]: https://github.com/test-kitchen/kitchen-ec2/blob/master/LICENSE
|
482
|
-
[repo]: https://github.com/test-kitchen/kitchen-ec2
|
483
|
-
[driver_usage]: https://github.com/test-kitchen/kitchen-ec2
|
484
|
-
[chef_omnibus_dl]: https://downloads.chef.io/chef
|
485
|
-
[amis_json]: https://github.com/test-kitchen/kitchen-ec2/blob/master/data/amis.json
|
486
|
-
[ami_docs]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ComponentsAMIs.html
|
487
|
-
[aws_site]: http://aws.amazon.com/
|
488
|
-
[iam_site]: http://aws.amazon.com/iam
|
489
|
-
[credentials_docs]: https://aws.amazon.com/blogs/security/a-new-and-standardized-way-to-manage-credentials-in-the-aws-sdks/
|
490
|
-
[aws_sdk_gem]: https://docs.aws.amazon.com/sdkforruby/api/index.html
|
491
|
-
[group_docs]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-network-security.html
|
492
|
-
[instance_docs]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html
|
493
|
-
[key_id_docs]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html
|
494
|
-
[kitchenci]: https://kitchen.ci/
|
495
|
-
[region_docs]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html
|
496
|
-
[subnet_docs]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html
|
497
|
-
[vpc_docs]: https://docs.aws.amazon.com/AmazonVPC/latest/GettingStartedGuide/ExerciseOverview.html
|