@@ -9,36 +9,53 @@ An InfraKit instance plugin is provided, which creates Amazon EC2 instances.
99### Building and running
1010
1111To 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 ` .
1313
1414At a minimum, the plugin requires the AWS region to use. However, this can be inferred from instance metadata when the
1515plugin is running within EC2. In other cases, specify the ` --region ` argument:
1616``` 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
2129```
2230
2331### Example
2432
2533To continue with an example, we will use the [ default] ( https://github.com/docker/infrakit/tree/master/cmd/group ) Group
2634plugin:
2735``` 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
3446```
3547
3648and the [ Vanilla] ( https://github.com/docker/infrakit/tree/master/pkg/example/flavor/vanilla ) Flavor plugin:.
3749``` 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
4259```
4360
4461We will use a basic configuration that creates a single instance:
@@ -51,11 +68,11 @@ $ cat << EOF > aws-vanilla.json
5168 "Size": 1
5269 },
5370 "Instance": {
54- "Plugin": "instance- aws/ec2-instance",
71+ "Plugin": "aws/ec2-instance",
5572 "Properties": {
5673 "RunInstancesInput": {
5774 "ImageId": "ami-4926fd29",
58- "KeyName": "bill -laptop",
75+ "KeyName": "my -laptop",
5976 "Placement": {
6077 "AvailabilityZone": "us-west-2a"
6178 },
@@ -67,7 +84,7 @@ $ cat << EOF > aws-vanilla.json
6784 }
6885 },
6986 "Flavor": {
70- "Plugin": "flavor- vanilla",
87+ "Plugin": "vanilla",
7188 "Properties": {
7289 "Init": [
7390 "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
91108
92109Finally, instruct the Group plugin to start watching the group:
93110``` console
94- $ build/infrakit group commit aws-vanilla.json
111+ $ build/infrakit group-stateless commit aws-vanilla.json
95112Committed aws-example: Managing 1 instances
96113```
97114
@@ -104,7 +121,7 @@ INFO[1219] Created instance i-ba0412a2 with tags map[infrakit.config_sha:dUBtWGm
104121
105122Additionally, the CLI will report the newly-created instance:
106123``` console
107- $ build/infrakit group inspect aws-example
124+ $ build/infrakit group-stateless inspect aws-example
108125ID LOGICAL TAGS
109126i-ba0412a2 172.31.41.13 Name=infrakit-example,infrakit.config_sha=dUBtWGmkptbGg29ecBgv1VJYzys=,infrakit.group=aws-example
110127```
0 commit comments