kitchen-ec2 0.10.0 → 1.0.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/.travis.yml +5 -1
- data/CHANGELOG.md +1 -1
- data/Gemfile +4 -1
- data/README.md +218 -234
- data/kitchen-ec2.gemspec +1 -0
- data/lib/kitchen/driver/aws/client.rb +3 -8
- data/lib/kitchen/driver/aws/instance_generator.rb +11 -65
- data/lib/kitchen/driver/aws/standard_platform.rb +229 -0
- data/lib/kitchen/driver/aws/standard_platform/centos.rb +46 -0
- data/lib/kitchen/driver/aws/standard_platform/debian.rb +50 -0
- data/lib/kitchen/driver/aws/standard_platform/fedora.rb +34 -0
- data/lib/kitchen/driver/aws/standard_platform/freebsd.rb +37 -0
- data/lib/kitchen/driver/aws/standard_platform/rhel.rb +40 -0
- data/lib/kitchen/driver/aws/standard_platform/ubuntu.rb +34 -0
- data/lib/kitchen/driver/aws/standard_platform/windows.rb +138 -0
- data/lib/kitchen/driver/ec2.rb +171 -117
- data/lib/kitchen/driver/ec2_version.rb +1 -1
- data/spec/kitchen/driver/ec2/client_spec.rb +3 -17
- data/spec/kitchen/driver/ec2/image_selection_spec.rb +350 -0
- data/spec/kitchen/driver/ec2/instance_generator_spec.rb +94 -188
- data/spec/kitchen/driver/ec2_spec.rb +5 -29
- metadata +29 -6
- data/data/amis.json +0 -118
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1de9e6f3ad8a3af4870ff7a4766a1be72d9c0b31
|
4
|
+
data.tar.gz: 2776133704a238453b242c99bc3390295f522f98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19a1e7124975185de7cb7b94be6852db2fd3e2381d6214f86229c2eb55d0e4d6d20d67ac1363c7fa357393e1753dd412583f8487ebe12566ed1def4433f2434a
|
7
|
+
data.tar.gz: a4bcc544a26388e68db518e418d93da07bde5675d7a56aab389197e2fd6dcd6c58bc4921a9383997c93c94a6947d1e33e6b6ae2f70205dbca2195765feb6535f
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,95 +1,160 @@
|
|
1
1
|
# <a name="title"></a> Kitchen::Ec2: A Test Kitchen Driver for Amazon EC2
|
2
2
|
|
3
|
-
[![Gem Version](https://badge.fury.io/rb/kitchen-ec2.
|
4
|
-
[![Build Status](https://travis-ci.org/test-kitchen/kitchen-ec2.
|
5
|
-
[![Code Climate](https://codeclimate.com/github/test-kitchen/kitchen-ec2.
|
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
6
|
|
7
7
|
A [Test Kitchen][kitchenci] Driver for Amazon EC2.
|
8
8
|
|
9
9
|
This driver uses the [aws sdk gem][aws_sdk_gem] to provision and destroy EC2
|
10
10
|
instances. Use Amazon's cloud for your infrastructure testing!
|
11
11
|
|
12
|
+
## Initial Setup
|
13
|
+
|
14
|
+
To get started, you need to install the software and set up your credentials and SSH key. Some of these steps you have probably already done, but we include them here for completeness.
|
15
|
+
|
16
|
+
1. Install the latest test-kitchen or ChefDK and put it in your path.
|
17
|
+
2. From this repository, type `bundle install; bundle exec rake install` to install the latest version of the driver.
|
18
|
+
3. Install the [AWS command line tools](http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-set-up.html).
|
19
|
+
4. Run `aws configure` to place your AWS credentials on the drive at ~/.aws/credentials.
|
20
|
+
5. Create your AWS SSH key. We recommend naming it with your username, but you can use any name:
|
21
|
+
|
22
|
+
```
|
23
|
+
aws ec2 create-key-pair --key-name $USER | ruby -e "require 'json'; puts JSON.parse(STDIN.read)['KeyMaterial']" > ~/.ssh/$USER
|
24
|
+
```
|
25
|
+
6. `export AWS_SSH_KEY_ID=<your key name>`
|
26
|
+
|
27
|
+
## Quick Start
|
28
|
+
|
29
|
+
Once
|
30
|
+
that is done, create your kitchen file in your cookbook directory (or an empty
|
31
|
+
directory if you just want to get a feel for it):
|
32
|
+
|
33
|
+
1. `kitchen init -D ec2`
|
34
|
+
2. Edit `.kitchen.yml` and add the aws_ssh_key_id to driver and a transport with
|
35
|
+
an ssh_key:
|
36
|
+
|
37
|
+
```yaml
|
38
|
+
transport:
|
39
|
+
ssh_key: ~/.ssh/your_private_key_file
|
40
|
+
```
|
41
|
+
3. While you are in there, modify `centos-7.1` to `centos-7`.
|
42
|
+
3. `kitchen test`
|
43
|
+
|
44
|
+
It's that easy! This will set up and run centos and ubuntu flavored instances.
|
45
|
+
|
12
46
|
## Requirements
|
13
47
|
|
14
48
|
There are **no** external system requirements for this driver. However you
|
15
49
|
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.
|
16
50
|
|
17
|
-
##
|
51
|
+
## Configuration
|
18
52
|
|
19
|
-
|
53
|
+
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.
|
20
54
|
|
21
|
-
|
55
|
+
### Specifying the Image
|
22
56
|
|
23
|
-
|
24
|
-
|
57
|
+
There are three ways to specify the image you use for the instance: `image_id`,
|
58
|
+
`image_search` and `platform.name`
|
25
59
|
|
26
|
-
|
27
|
-
automatically from Amazon EC2 with the same private key as we use for
|
28
|
-
SSH logins to Linux.
|
60
|
+
#### `image_id`
|
29
61
|
|
30
|
-
|
62
|
+
`image_id` can be set explicitly. It must be an ami in the region you are
|
63
|
+
working with!
|
31
64
|
|
32
|
-
```
|
33
|
-
|
65
|
+
```yaml
|
66
|
+
platforms:
|
67
|
+
- name: centos-7
|
68
|
+
image_id: ami-96a818fe
|
69
|
+
```
|
70
|
+
|
71
|
+
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````.
|
72
|
+
|
73
|
+
#### `image_search`
|
74
|
+
|
75
|
+
`image_search` lets you specify a series of key/value pairs to search for the
|
76
|
+
image. If a value is set to an array, then *any* of those values will match.
|
77
|
+
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).
|
78
|
+
|
79
|
+
```yaml
|
34
80
|
platforms:
|
35
|
-
- name: ubuntu-10.04
|
36
|
-
- name: ubuntu-12.04
|
37
|
-
- name: ubuntu-12.10
|
38
|
-
- name: ubuntu-13.04
|
39
|
-
- name: ubuntu-13.10
|
40
81
|
- name: ubuntu-14.04
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
- name: windows-2008r2
|
82
|
+
image_search:
|
83
|
+
owner-id: "099720109477"
|
84
|
+
name: ubuntu/images/*/ubuntu-*-14.04*
|
45
85
|
```
|
46
86
|
|
47
|
-
|
87
|
+
In the event that there are multiple matches (as sometimes happens), we sort to
|
88
|
+
get the best results. In order of priority from greatest to least, we prefer:
|
48
89
|
|
49
|
-
|
50
|
-
|
90
|
+
- HVM images over paravirtual
|
91
|
+
- SSD support over magnetic drives
|
92
|
+
- 64-bit over 32-bit
|
93
|
+
- The most recently created image (to pick up patch releases)
|
94
|
+
|
95
|
+
#### `platform.name`
|
96
|
+
|
97
|
+
The third way to specify the image is by leaving `image_id` and `image_search`
|
98
|
+
blank, and specifying a standard platform name.
|
99
|
+
|
100
|
+
```yaml
|
51
101
|
platforms:
|
52
|
-
- name: ubuntu-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
#
|
102
|
+
- name: ubuntu-14.04
|
103
|
+
```
|
104
|
+
|
105
|
+
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
|
106
|
+
the given OS in your region. You may leave versions off, specify partial versions,
|
107
|
+
and you may specify architecture to distinguish 32- and 64-bit. Some examples:
|
108
|
+
|
109
|
+
```yaml
|
110
|
+
platforms:
|
111
|
+
# The latest stable minor+patch release of rhel 6
|
112
|
+
- name: rhel-6
|
113
|
+
# The latest patch release of CentOS 6.3
|
114
|
+
- name: centos-6.3
|
115
|
+
# 32-bit version of latest major+minor+patch release of Ubuntu
|
116
|
+
- name: ubuntu-i386
|
117
|
+
# 32-bit version of Debian 6
|
118
|
+
- name: debian-6-i386
|
119
|
+
# Latest 32-bit stable minor release of freebsd 10
|
120
|
+
- name: freebsd-10-i386
|
121
|
+
# The latest stable major+minor+patch release of Fedora
|
122
|
+
- name: fedora
|
123
|
+
# The most recent service-pack for Windows 2012 (not R2)
|
124
|
+
- name: windows-2012
|
125
|
+
# The most recent service-pack for Windows 2012R2
|
64
126
|
- name: windows-2012r2
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
# ...
|
127
|
+
# Windows 2008 RTM (not R2, no service pack)
|
128
|
+
- name: windows-2008rtm
|
129
|
+
# Windows 2008R2 SP1
|
130
|
+
- name: windows-2008r2sp1
|
70
131
|
```
|
71
132
|
|
72
|
-
|
133
|
+
We always pick the highest released stable version that matches your regex, and
|
134
|
+
follow the other `image_search` rules for preference.
|
73
135
|
|
74
|
-
|
136
|
+
### AWS Authentication
|
75
137
|
|
76
|
-
|
138
|
+
In order to connect to AWS, you must specify the AWS access key id and secret key
|
139
|
+
for your account. There are 3 ways you do this, and we will try them in the
|
77
140
|
following order:
|
78
141
|
|
79
142
|
1. You can specify the access key and access secret (and optionally the session
|
80
|
-
token) through config. See the `aws_access_key_id` and `aws_secret_access_key`
|
81
|
-
config sections below to see how to specify these in your .kitchen.yml or
|
82
|
-
through environment variables. If you would like to specify your session token
|
83
|
-
use the environment variable `AWS_SESSION_TOKEN`.
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
143
|
+
token) through config. See the `aws_access_key_id` and `aws_secret_access_key`
|
144
|
+
config sections below to see how to specify these in your .kitchen.yml or
|
145
|
+
through environment variables. If you would like to specify your session token
|
146
|
+
use the environment variable `AWS_SESSION_TOKEN`.
|
147
|
+
2. The shared credentials ini file at `~/.aws/credentials`. This is the file
|
148
|
+
populated by `aws configure` command line and used by AWS tools in general, so if
|
149
|
+
you are set up for any other AWS tools, you probably already have this. You can
|
150
|
+
specify multiple profiles in this file and select one with the `AWS_PROFILE`
|
151
|
+
environment variable or the `shared_credentials_profile` driver config. Read
|
152
|
+
[this][credentials_docs] for more information.
|
153
|
+
3. From an instance profile when running on EC2. This accesses the local
|
154
|
+
metadata service to discover the local instance's IAM instance profile.
|
90
155
|
|
91
156
|
This precedence order is taken from http://docs.aws.amazon.com/sdkforruby/api/index.html#Configuration
|
92
|
-
|
157
|
+
|
93
158
|
The first method attempted that works will be used. IE, if you want to auth
|
94
159
|
using the instance profile, you must not set any of the access key configs
|
95
160
|
or environment variables, and you must not specify a `~/.aws/credentials`
|
@@ -97,115 +162,110 @@ file.
|
|
97
162
|
|
98
163
|
Because the Test Kitchen test should be checked into source control and ran
|
99
164
|
through CI we no longer recommend storing the AWS credentials in the
|
100
|
-
`.kitchen.yml` file. Instead, specify them as environment variables or in the
|
165
|
+
`.kitchen.yml` file. Instead, specify them as environment variables or in the
|
101
166
|
`~/.aws/credentials` file.
|
102
167
|
|
103
|
-
|
168
|
+
### Instance Login Configuration
|
104
169
|
|
105
|
-
|
106
|
-
|
170
|
+
The instances you create use credentials you specify which are *separate* from
|
171
|
+
the AWS credentials. Generally, SSH and WinRM use an AWS key pair which you
|
172
|
+
specify. You probably set this up in the Initial Setup.
|
107
173
|
|
108
|
-
|
109
|
-
from the transport options to the Aministrator group. If no `username` is
|
110
|
-
specified then the default `administrator` is available.
|
111
|
-
|
112
|
-
AWS automatically generates an `administrator` password in the default
|
113
|
-
Windows AMIs. Test Kitchen fetches this and stores it in the
|
114
|
-
`.kitchen/#{platform}.json` file. If you need to `kitchen login` to the instance
|
115
|
-
and you have not specified your own `username` and `password` you can use
|
116
|
-
the `administrator` user and the password from this file. Unfortunately
|
117
|
-
we cannot auto-fill the RDP password at this point.
|
174
|
+
#### `aws_ssh_key_id`
|
118
175
|
|
119
|
-
|
176
|
+
The ID of the AWS key pair you want to use.
|
120
177
|
|
121
|
-
|
178
|
+
The default will be read from the `AWS_SSH_KEY_ID` environment variable if set,
|
179
|
+
or `nil` otherwise.
|
122
180
|
|
123
|
-
|
124
|
-
the letter designation - will attach this to the region used.
|
181
|
+
This must be one of the KeyName values shown by the AWS CLI: `aws ec2 describe-key-pairs`
|
125
182
|
|
126
|
-
|
183
|
+
#### `transport.ssh_key`
|
127
184
|
|
128
|
-
|
185
|
+
The private key file for the AWS key pair you want to use.
|
129
186
|
|
130
|
-
|
131
|
-
`~/.aws/credentials` file instead.
|
187
|
+
#### `transport.username`
|
132
188
|
|
133
|
-
|
189
|
+
This is not strictly a `driver` thing, but the username is a crucial component
|
190
|
+
of logging in to an instance. Different AMIs tend to provide different usernames.
|
134
191
|
|
135
|
-
|
192
|
+
If you use an official AMI (or create an image with the platform name in the
|
193
|
+
image name), we will use the default username for official AMIs for that platform.
|
136
194
|
|
137
|
-
|
138
|
-
`~/.aws/credentials` file instead.
|
195
|
+
#### `ebs_optimized`
|
139
196
|
|
140
|
-
|
197
|
+
Option to launch EC2 instance with optimized EBS volume. See
|
198
|
+
[Amazon EC2 Instance Types](http://aws.amazon.com/ec2/instance-types/) to find
|
199
|
+
out more about instance types that can be launched as EBS-optimized instances.
|
141
200
|
|
142
|
-
|
201
|
+
The default is `false`.
|
143
202
|
|
144
|
-
|
145
|
-
of `~/.aws/credentials`. If it is not specified AWS will read the `Default`
|
146
|
-
profile credentials (if using this method of authentication).
|
203
|
+
#### Password
|
147
204
|
|
148
|
-
|
205
|
+
For Windows instances the generated Administrator password is fetched
|
206
|
+
automatically from Amazon EC2 with the same private key as we use for
|
207
|
+
SSH logins to Linux.
|
149
208
|
|
150
|
-
###
|
209
|
+
### Windows Configuration
|
151
210
|
|
152
|
-
|
211
|
+
If you specify a platform name starting with `windows`, Test Kitchen will pull a
|
212
|
+
default AMI out of `amis.json` if one is not specified.
|
153
213
|
|
154
|
-
The default will
|
155
|
-
|
214
|
+
The default user_data will add any `username` with its associated `password`
|
215
|
+
from the transport options to the Aministrator group. If no `username` is
|
216
|
+
specified then the default `administrator` is available.
|
156
217
|
|
157
|
-
|
218
|
+
AWS automatically generates an `administrator` password in the default
|
219
|
+
Windows AMIs. Test Kitchen fetches this and stores it in the
|
220
|
+
`.kitchen/#{platform}.json` file. If you need to `kitchen login` to the instance
|
221
|
+
and you have not specified your own `username` and `password` you can use
|
222
|
+
the `administrator` user and the password from this file. Unfortunately
|
223
|
+
we cannot auto-fill the RDP password at this point.
|
158
224
|
|
159
|
-
|
160
|
-
`~/.aws/credentials` file instead.
|
225
|
+
### Other Configuration
|
161
226
|
|
162
|
-
|
227
|
+
#### `availability_zone`
|
163
228
|
|
164
|
-
|
229
|
+
The AWS [availability zone][region_docs] to use. Only request
|
230
|
+
the letter designation - will attach this to the region used.
|
165
231
|
|
166
|
-
|
232
|
+
If not specified, your instances will be placed in an AZ of AWS's choice in your
|
233
|
+
region.
|
167
234
|
|
168
|
-
### <a name="config-instance_type"></a>
|
235
|
+
### <a name="config-instance_type"></a> `instance_type`
|
169
236
|
|
170
237
|
The EC2 [instance type][instance_docs] (also known as size) to use.
|
171
238
|
|
172
|
-
The default is `
|
239
|
+
The default is `t2.micro` or `t1.micro`, depending on whether the image is `hvm`
|
240
|
+
or `paravirtual`. (`paravirtual` images are incompatible with `t2.micro`.)
|
173
241
|
|
174
|
-
### security_group_ids
|
242
|
+
### `security_group_ids`
|
175
243
|
|
176
244
|
An Array of EC2 [security groups][group_docs] which will be applied to the
|
177
245
|
instance.
|
178
246
|
|
179
247
|
The default is `["default"]`.
|
180
248
|
|
181
|
-
###
|
182
|
-
|
183
|
-
**Required** The EC2 [AMI id][ami_docs] to use.
|
184
|
-
|
185
|
-
The default will be determined by the `aws_region` chosen and the Platform
|
186
|
-
name, if a default exists (see [amis.json][ami_json]). If a default cannot be
|
187
|
-
computed, then the default is `nil`.
|
188
|
-
|
189
|
-
### region
|
249
|
+
### `region`
|
190
250
|
|
191
251
|
**Required** The AWS [region][region_docs] to use.
|
192
252
|
|
193
253
|
If the environment variable `AWS_REGION` is populated that will be used.
|
194
254
|
Otherwise the default is `"us-east-1"`.
|
195
255
|
|
196
|
-
###
|
256
|
+
### `subnet_id`
|
197
257
|
|
198
258
|
The EC2 [subnet][subnet_docs] to use.
|
199
259
|
|
200
260
|
The default is unset, or `nil`.
|
201
261
|
|
202
|
-
### tags
|
262
|
+
### `tags`
|
203
263
|
|
204
264
|
The Hash of EC tag name/value pairs which will be applied to the instance.
|
205
265
|
|
206
266
|
The default is `{ "created-by" => "test-kitchen" }`.
|
207
267
|
|
208
|
-
###
|
268
|
+
### `user_data`
|
209
269
|
|
210
270
|
The user_data script or the path to a script to feed the instance.
|
211
271
|
Use bash to install dependencies or download artifacts before chef runs.
|
@@ -218,19 +278,19 @@ On Windows instances we specify a default that enables winrm and
|
|
218
278
|
adds a non-administrator user specified in the `username` transport
|
219
279
|
options to the Administrator's User Group.
|
220
280
|
|
221
|
-
###
|
281
|
+
### `iam_profile_name`
|
222
282
|
|
223
283
|
The EC2 IAM profile name to use.
|
224
284
|
|
225
285
|
The default is `nil`.
|
226
286
|
|
227
|
-
### price
|
287
|
+
### `price`
|
228
288
|
|
229
289
|
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.
|
230
290
|
|
231
291
|
The default is `nil`.
|
232
292
|
|
233
|
-
###
|
293
|
+
### `http_proxy`
|
234
294
|
|
235
295
|
Specify a proxy to send AWS requests through. Should be of the format `http://<host>:<port>`.
|
236
296
|
|
@@ -238,62 +298,42 @@ The default is `ENV["HTTPS_PROXY"] || ENV["HTTP_PROXY"]`. If you have these env
|
|
238
298
|
|
239
299
|
**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.
|
240
300
|
|
241
|
-
|
242
|
-
|
243
|
-
### ebs\_volume\_size
|
244
|
-
|
245
|
-
**Deprecated** See [block_device_mappings](#config-block_device_mappings) below.
|
246
|
-
|
247
|
-
Size of ebs volume in GB.
|
248
|
-
|
249
|
-
### ebs\_delete\_on\_termination
|
301
|
+
### Disk Configuration
|
250
302
|
|
251
|
-
|
252
|
-
|
253
|
-
`true` if you want ebs volumes to get deleted automatically after instance is terminated, `false` otherwise
|
254
|
-
|
255
|
-
### ebs\_device\_name
|
256
|
-
|
257
|
-
**Deprecated** See [block_device_mappings](#config-block_device_mappings) below.
|
258
|
-
|
259
|
-
name of your ebs device, for example: `/dev/sda1`
|
260
|
-
|
261
|
-
### <a name="config-block_device_mappings"></a> block\_device\_mappings
|
303
|
+
#### <a name="config-block_device_mappings"></a> `block_device_mappings`
|
262
304
|
|
263
305
|
A list of block device mappings for the machine. An example of all available keys looks like:
|
264
306
|
```yaml
|
265
307
|
block_device_mappings:
|
266
|
-
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
308
|
+
- device_name: /dev/sda
|
309
|
+
ebs:
|
310
|
+
volume_size: 20
|
311
|
+
delete_on_termination: true
|
312
|
+
- device_name: /dev/sdb
|
313
|
+
ebs:
|
314
|
+
volume_type: gp2
|
315
|
+
virtual_name: test
|
316
|
+
volume_size: 15
|
317
|
+
delete_on_termination: true
|
318
|
+
snapshot_id: snap-0015d0bc
|
319
|
+
- device_name: /dev/sdc
|
320
|
+
ebs:
|
321
|
+
volume_size: 100
|
322
|
+
delete_on_termination: true
|
323
|
+
volume_type: io1
|
324
|
+
iops: 100
|
280
325
|
```
|
281
326
|
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
The keys `ebs_volume_type`, `ebs_virtual_name` and `ebs_snapshot_id` are optional. See
|
287
|
-
[Amazon EBS Volume Types](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html) to find out more about
|
288
|
-
volume types. `ebs_volume_type` defaults to `standard` but can also be `gp2` or `io1`. If you specify `io1` you must
|
289
|
-
also specify `ebs_iops`.
|
327
|
+
See
|
328
|
+
[Amazon EBS Volume Types](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html)
|
329
|
+
to find out more about volume types.
|
290
330
|
|
291
|
-
If you have a block device mapping with a `
|
331
|
+
If you have a block device mapping with a `device_name` equal to the root storage device name on your
|
292
332
|
[image](#config-image-id) then the provided mapping will replace the settings in the image.
|
293
333
|
|
294
334
|
If this is not provided it will use the default block_device_mappings from the AMI.
|
295
335
|
|
296
|
-
|
336
|
+
#### `ebs_optimized`
|
297
337
|
|
298
338
|
Option to launch EC2 instance with optimized EBS volume. See
|
299
339
|
[Amazon EC2 Instance Types](http://aws.amazon.com/ec2/instance-types/) to find
|
@@ -301,9 +341,9 @@ out more about instance types that can be launched as EBS-optimized instances.
|
|
301
341
|
|
302
342
|
The default is `false`.
|
303
343
|
|
304
|
-
|
344
|
+
### Network and Communication Configuration
|
305
345
|
|
306
|
-
|
346
|
+
#### `associate_public_ip`
|
307
347
|
|
308
348
|
AWS does not automatically allocate public IP addresses for instances created
|
309
349
|
within non-default [subnets][subnet_docs]. Set this option to `true` to force
|
@@ -317,13 +357,13 @@ instance unless you have a VPN connection to your
|
|
317
357
|
The default is `true` if you have configured a [subnet_id](#config-subnet-id),
|
318
358
|
or `false` otherwise.
|
319
359
|
|
320
|
-
|
360
|
+
#### `private_ip_address`
|
321
361
|
|
322
362
|
The primary private IP address of your instance.
|
323
363
|
|
324
364
|
If you don't set this it will default to whatever DHCP address EC2 hands out.
|
325
365
|
|
326
|
-
|
366
|
+
#### `interface`
|
327
367
|
|
328
368
|
The place from which to derive the hostname for communicating with the instance. May be `dns`, `public` or `private`. If this is unset, the driver will derive the hostname by failing back in the following order:
|
329
369
|
|
@@ -333,63 +373,6 @@ The place from which to derive the hostname for communicating with the instance.
|
|
333
373
|
|
334
374
|
The default is unset.
|
335
375
|
|
336
|
-
### ssh\_key
|
337
|
-
|
338
|
-
**Deprecated** Instead use the `ssh_key` transport option like
|
339
|
-
|
340
|
-
```ruby
|
341
|
-
transport:
|
342
|
-
ssh_key: ~/.ssh/id_rsa
|
343
|
-
```
|
344
|
-
|
345
|
-
Path to the private SSH key used to connect to the instance.
|
346
|
-
|
347
|
-
The default is unset, or `nil`.
|
348
|
-
|
349
|
-
### ssh\_timeout
|
350
|
-
|
351
|
-
**Deprecated** Instead use the `connection_timeout` transport key like
|
352
|
-
|
353
|
-
```ruby
|
354
|
-
transport:
|
355
|
-
connection_timeout: 60
|
356
|
-
```
|
357
|
-
|
358
|
-
The number of seconds to sleep before trying to SSH again.
|
359
|
-
|
360
|
-
The default is `1`.
|
361
|
-
|
362
|
-
### ssh\_retries
|
363
|
-
|
364
|
-
**Deprecated** Instead use the `connection_retries` transport key like
|
365
|
-
|
366
|
-
```ruby
|
367
|
-
transport:
|
368
|
-
connection_retries: 10
|
369
|
-
```
|
370
|
-
|
371
|
-
The number of times to retry SSH-ing into the instance.
|
372
|
-
|
373
|
-
The default is `3`.
|
374
|
-
|
375
|
-
### username
|
376
|
-
|
377
|
-
**Deprecated** Instead use the `username` transport key like
|
378
|
-
|
379
|
-
```ruby
|
380
|
-
transport:
|
381
|
-
username: ubuntu
|
382
|
-
```
|
383
|
-
|
384
|
-
The SSH username that will be used to communicate with the instance.
|
385
|
-
|
386
|
-
The default will be determined by the Platform name, if a default exists (see
|
387
|
-
[amis.json][amis_json]). If a default cannot be computed, then the default is
|
388
|
-
`"root"`.
|
389
|
-
|
390
|
-
On Windows hosts with the default `user_data` this user is added to the
|
391
|
-
Administrator's group.
|
392
|
-
|
393
376
|
## Example
|
394
377
|
|
395
378
|
The following could be used in a `.kitchen.yml` or in a `.kitchen.local.yml`
|
@@ -423,20 +406,22 @@ platforms:
|
|
423
406
|
driver:
|
424
407
|
image_id: ami-83211eb3
|
425
408
|
block_device_mappings:
|
426
|
-
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
409
|
+
- device_name: /dev/sda1
|
410
|
+
ebs:
|
411
|
+
volume_type: standard
|
412
|
+
virtual_name: test
|
413
|
+
volume_size: 15
|
414
|
+
delete_on_termination: true
|
431
415
|
- name: centos-7
|
432
416
|
driver:
|
433
417
|
image_id: ami-c7d092f7
|
434
418
|
block_device_mappings:
|
435
|
-
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
419
|
+
- device_name: /dev/sdb
|
420
|
+
ebs:
|
421
|
+
volume_type: gp2
|
422
|
+
virtual_name: test
|
423
|
+
volume_size: 8
|
424
|
+
delete_on_termination: true
|
440
425
|
transport:
|
441
426
|
username: centos
|
442
427
|
- name: windows-2012r2
|
@@ -475,8 +460,7 @@ Apache 2.0 (see [LICENSE][license])
|
|
475
460
|
[license]: https://github.com/test-kitchen/kitchen-ec2/blob/master/LICENSE
|
476
461
|
[repo]: https://github.com/test-kitchen/kitchen-ec2
|
477
462
|
[driver_usage]: https://github.com/test-kitchen/kitchen-ec2
|
478
|
-
[chef_omnibus_dl]:
|
479
|
-
|
463
|
+
[chef_omnibus_dl]: https://downloads.chef.io/chef-client/
|
480
464
|
[amis_json]: https://github.com/test-kitchen/kitchen-ec2/blob/master/data/amis.json
|
481
465
|
[ami_docs]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ComponentsAMIs.html
|
482
466
|
[aws_site]: http://aws.amazon.com/
|