@@ -9,36 +9,53 @@ An InfraKit instance plugin is provided, which creates Amazon EC2 instances.
9
9
### Building and running
10
10
11
11
To build the AWS Instance plugin, run ` make binaries ` . The plugin binary will be located at
12
- ` ./build/infrakit-instance-aws ` .
12
+ ` ./build/infrakit plugin start aws --log 5 ` .
13
13
14
14
At a minimum, the plugin requires the AWS region to use. However, this can be inferred from instance metadata when the
15
15
plugin is running within EC2. In other cases, specify the ` --region ` argument:
16
16
``` console
17
- $ build/infrakit-instance-aws --region us-west-2
18
- INFO[0000] Starting plugin
19
- INFO[0000] Listening on: unix:///run/infrakit/plugins/instance-vagrant.sock
20
- INFO[0000] listener protocol= unix addr= /run/infrakit/plugins/instance-vagrant.sock err= <nil>
17
+ $ INFRAKIT_AWS_REGION=us-west-2 build/infrakit plugin start aws --log 5
18
+ INFO[11-06|16:56:32] config module=cli/plugin url= fn=github.com/docker/infrakit/cmd/infrakit/plugin.Command.func2
19
+ INFO[11-06|16:56:32] Launching module=cli/plugin kind=aws name=aws fn=github.com/docker/infrakit/cmd/infrakit/plugin.Command.func2
20
+ INFO[11-06|16:56:32] Starting plugin module=core/launch executor=inproc key=aws name=aws exec=inproc fn=github.com/docker/infrakit/pkg/launch.(*Monitor).Start.func1
21
+ INFO[11-06|16:56:32] Starting module=aws/metadata context="&{update:<nil> poll:60000000000 templateURL: templateOptions:{DelimLeft: DelimRight: CustomizeFetch:<nil> Stderr:<nil> MultiPass:false CacheDir:} stop:0xc42021c180 stackName: clients:{Cfn:0xc42000e8f0 Ec2:0xc42000e900 Asg:0xc42000e910} impl:<nil>}" poll=1m0s fn=github.com/docker/infrakit/pkg/provider/aws/plugin/metadata.(*Context).start
22
+ INFO[11-06|16:56:32] Object is an event producer module=rpc/server object="&{plugin:<nil> typedPlugins:map[ec2-instance:0xc42053a4c0]}" discover=/Users/infrakit/.infrakit/plugins/aws fn=github.com/docker/infrakit/pkg/rpc/server.startAtPath
23
+ INFO[0000] Start monitoring instances 0xc42021cb40
24
+ INFO[11-06|16:56:32] Listening module=rpc/server discover=/Users/infrakit/.infrakit/plugins/aws fn=github.com/docker/infrakit/pkg/rpc/server.startAtPath
25
+ INFO[11-06|16:56:32] Waiting for startup module=core/launch key=aws name=aws config="{\n\"Kind\": \"aws\",\n\"Options\": {\n\"Namespace\": {},\n\"ELBNames\": [\n\"\"\n],\n\"Region\": \"ca-central-1\",\n\"AccessKeyID\": \"\",\n\"SecretAccessKey\": \"\",\n\"SessionToken\": \"\",\n\"Retries\": 0,\n\"Debug\": false,\n\"Template\": \"\",\n\"TemplateOptions\": {\n\"DelimLeft\": \"\",\n\"DelimRight\": \"\",\n\"MultiPass\": false,\n\"CacheDir\": \"\"\n},\n\"StackName\": \"\",\n\"PollInterval\": \"1m0s\"\n}\n}" as=aws fn=github.com/docker/infrakit/pkg/launch.(*Monitor).Start.func1
26
+ INFO[11-06|16:56:32] Done waiting on plugin starts module=cli/plugin fn=github.com/docker/infrakit/cmd/infrakit/plugin.Command.func2
27
+ INFO[11-06|16:56:32] PID file created module=run path=/Users/infrakit/.infrakit/plugins/aws.pid fn=github.com/docker/infrakit/pkg/run.run.func1
28
+ INFO[11-06|16:56:32] Server started module=run discovery=/Users/infrakit/.infrakit/plugins/aws fn=github.com/docker/infrakit/pkg/run.run.func1
21
29
```
22
30
23
31
### Example
24
32
25
33
To continue with an example, we will use the [ default] ( https://github.com/docker/infrakit/tree/master/cmd/group ) Group
26
34
plugin:
27
35
``` console
28
- $ build/infrakit-group-default
29
- INFO[0000] Starting discovery
30
- INFO[0000] Starting plugin
31
- INFO[0000] Starting
32
- INFO[0000] Listening on: unix:///run/infrakit/plugins/group.sock
33
- INFO[0000] listener protocol= unix addr= /run/infrakit/plugins/group.sock err= <nil>
36
+ $ build/infrakit plugin start group
37
+ INFO[11-06|16:58:10] config module=cli/plugin url= fn=github.com/docker/infrakit/cmd/infrakit/plugin.Command.func2
38
+ INFO[11-06|16:58:10] Launching module=cli/plugin kind=group name=group-stateless fn=github.com/docker/infrakit/cmd/infrakit/plugin.Command.func2
39
+ INFO[11-06|16:58:10] Starting plugin module=core/launch executor=inproc key=group name=group-stateless exec=inproc fn=github.com/docker/infrakit/pkg/launch.(*Monitor).Start.func1
40
+ INFO[11-06|16:58:10] Object is an event producer module=rpc/server object=&{keyed:0xc4201862f8} discover=/Users/infrakit/.infrakit/plugins/group-stateless fn=github.com/docker/infrakit/pkg/rpc/server.startAtPath
41
+ INFO[11-06|16:58:10] Listening module=rpc/server discover=/Users/infrakit/.infrakit/plugins/group-stateless fn=github.com/docker/infrakit/pkg/rpc/server.startAtPath
42
+ INFO[11-06|16:58:10] Waiting for startup module=core/launch key=group name=group-stateless config="{\n\"Kind\": \"group\",\n\"Options\": {\n\"PollInterval\": \"10s\",\n\"MaxParallelNum\": 0,\n\"PollIntervalGroupSpec\": \"10s\",\n\"PollIntervalGroupDetail\": \"10s\"\n}\n}" as=group-stateless fn=github.com/docker/infrakit/pkg/launch.(*Monitor).Start.func1
43
+ INFO[11-06|16:58:10] Done waiting on plugin starts module=cli/plugin fn=github.com/docker/infrakit/cmd/infrakit/plugin.Command.func2
44
+ INFO[11-06|16:58:10] PID file created module=run path=/Users/infrakit/.infrakit/plugins/group-stateless.pid fn=github.com/docker/infrakit/pkg/run.run.func1
45
+ INFO[11-06|16:58:10] Server started module=run discovery=/Users/infrakit/.infrakit/plugins/group-stateless fn=github.com/docker/infrakit/pkg/run.run.func1
34
46
```
35
47
36
48
and the [ Vanilla] ( https://github.com/docker/infrakit/tree/master/pkg/example/flavor/vanilla ) Flavor plugin:.
37
49
``` console
38
- $ build/infrakit-flavor-vanilla
39
- INFO[0000] Starting plugin
40
- INFO[0000] Listening on: unix:///run/infrakit/plugins/flavor-vanilla.sock
41
- INFO[0000] listener protocol= unix addr= /run/infrakit/plugins/flavor-vanilla.sock err= <nil>
50
+ $ build/infrakit plugin start vanilla
51
+ INFO[11-06|16:59:01] config module=cli/plugin url= fn=github.com/docker/infrakit/cmd/infrakit/plugin.Command.func2
52
+ INFO[11-06|16:59:01] Launching module=cli/plugin kind=vanilla name=vanilla fn=github.com/docker/infrakit/cmd/infrakit/plugin.Command.func2
53
+ INFO[11-06|16:59:01] Starting plugin module=core/launch executor=inproc key=vanilla name=vanilla exec=inproc fn=github.com/docker/infrakit/pkg/launch.(*Monitor).Start.func1
54
+ INFO[11-06|16:59:01] Listening module=rpc/server discover=/Users/infrakit/.infrakit/plugins/vanilla fn=github.com/docker/infrakit/pkg/rpc/server.startAtPath
55
+ INFO[11-06|16:59:01] Waiting for startup module=core/launch key=vanilla name=vanilla config="{\n\"Kind\": \"vanilla\",\n\"Options\": {\n\"DelimLeft\": \"\",\n\"DelimRight\": \"\",\n\"MultiPass\": true,\n\"CacheDir\": \"\"\n}\n}" as=vanilla fn=github.com/docker/infrakit/pkg/launch.(*Monitor).Start.func1
56
+ INFO[11-06|16:59:01] Done waiting on plugin starts module=cli/plugin fn=github.com/docker/infrakit/cmd/infrakit/plugin.Command.func2
57
+ INFO[11-06|16:59:01] PID file created module=run path=/Users/infrakit/.infrakit/plugins/vanilla.pid fn=github.com/docker/infrakit/pkg/run.run.func1
58
+ INFO[11-06|16:59:01] Server started module=run discovery=/Users/infrakit/.infrakit/plugins/vanilla fn=github.com/docker/infrakit/pkg/run.run.func1
42
59
```
43
60
44
61
We will use a basic configuration that creates a single instance:
@@ -51,11 +68,11 @@ $ cat << EOF > aws-vanilla.json
51
68
"Size": 1
52
69
},
53
70
"Instance": {
54
- "Plugin": "instance- aws/ec2-instance",
71
+ "Plugin": "aws/ec2-instance",
55
72
"Properties": {
56
73
"RunInstancesInput": {
57
74
"ImageId": "ami-4926fd29",
58
- "KeyName": "bill -laptop",
75
+ "KeyName": "my -laptop",
59
76
"Placement": {
60
77
"AvailabilityZone": "us-west-2a"
61
78
},
@@ -67,7 +84,7 @@ $ cat << EOF > aws-vanilla.json
67
84
}
68
85
},
69
86
"Flavor": {
70
- "Plugin": "flavor- vanilla",
87
+ "Plugin": "vanilla",
71
88
"Properties": {
72
89
"Init": [
73
90
"sh -c \"echo 'Hello, World!' > /hello\""
@@ -91,7 +108,7 @@ The instance type is set to `m1.small` by default. Note that you cannot use HVM
91
108
92
109
Finally, instruct the Group plugin to start watching the group:
93
110
``` console
94
- $ build/infrakit group commit aws-vanilla.json
111
+ $ build/infrakit group-stateless commit aws-vanilla.json
95
112
Committed aws-example: Managing 1 instances
96
113
```
97
114
@@ -104,7 +121,7 @@ INFO[1219] Created instance i-ba0412a2 with tags map[infrakit.config_sha:dUBtWGm
104
121
105
122
Additionally, the CLI will report the newly-created instance:
106
123
``` console
107
- $ build/infrakit group inspect aws-example
124
+ $ build/infrakit group-stateless inspect aws-example
108
125
ID LOGICAL TAGS
109
126
i-ba0412a2 172.31.41.13 Name=infrakit-example,infrakit.config_sha=dUBtWGmkptbGg29ecBgv1VJYzys=,infrakit.group=aws-example
110
127
```
0 commit comments