forked from probcomp/probcomp-stack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
637 lines (555 loc) · 17.1 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
default-target: allclean .PHONY
.PHONY:
SHELL := $(SHELL) -eu
PROJECT = stack-20170505
SUBPROJECT = ami
AWS = aws
SSH = ssh
PROFILE = $(PROJECT)
AWSCLI = $(AWS) --profile $(PROFILE)
TAG_PROJECT = \
$(AWSCLI) ec2 create-tags \
--tags Key=probcomp/project,Value=$(PROJECT) \
--resources
TAG_NAME = \
$(AWSCLI) ec2 create-tags \
--tags Key=Name,Value=probcomp/$(@:.json=)/$(PROJECT) \
--resources
FILTER_PROJECT = \
--filters Name=tag-key,Values=probcomp/project \
--filters Name=tag-value,Values=$(PROJECT)
all: ami
allclean: .PHONY
allclean: all
$(MAKE) clean
clean: .PHONY
clean: clean-tmp
clean-tmp: .PHONY
-rm -f *.tmp
distclean: .PHONY
$(MAKE) clean
show: .PHONY
@echo $($(VAR))
DESCRIBE_RESOURCES = $(AWSCLI) ec2 describe-tags $(FILTER_PROJECT)
describe-resources: .PHONY
@$(DESCRIBE_RESOURCES)
###############################################################################
# VPC: Virtual Private Cloud
#
# A VPC is just a private IPv4 address space that can be partitioned
# into subnets and have two flags about DNS settings, described here:
#
# https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-dns.html
#
# General VPC documentation: https://aws.amazon.com/documentation/vpc/
# Parameters:
#
# VPC_CIDR_BLOCK
# Private IPv4 address range for the whole VPC.
VPC_CIDR_BLOCK = 10.0.0.0/16
vpc.json:
-rm -f [email protected]
$(AWSCLI) ec2 create-vpc \
--cidr-block $(VPC_CIDR_BLOCK) \
vpc_id=`jq -r .Vpc.VpcId < [email protected]` && \
$(TAG_PROJECT) "$$vpc_id" && \
$(TAG_NAME) "$$vpc_id" && \
$(AWSCLI) ec2 modify-vpc-attribute \
--enable-dns-hostnames \
--vpc-id "$$vpc_id" \
&& \
$(AWSCLI) ec2 modify-vpc-attribute \
--enable-dns-support \
--vpc-id "$$vpc_id" \
&& \
mv -f [email protected] $@
DESCRIBE_VPCS = $(AWSCLI) ec2 describe-vpcs $(FILTER_PROJECT)
describe-vpcs: .PHONY
@$(DESCRIBE_VPCS)
LIST_VPCS = $(DESCRIBE_VPCS) | jq -r '.Vpcs[].VpcId'
list-vpcs: .PHONY
@$(LIST_VPCS)
clean: _clean-vpcs
_clean-vpcs: .PHONY
_clean-vpcs: _clean-gateways
_clean-vpcs: _clean-secgroups
_clean-vpcs: _clean-subnets
$(MAKE) clean-vpcs
clean-vpcs: .PHONY
@echo '#' WARNING: May fail if there are still subnets in use.
$(LIST_VPCS) \
| while read id; do \
$(AWSCLI) ec2 delete-vpc --vpc-id "$$id"; \
done
-rm -f vpc.json
###############################################################################
# Security Groups
#
# A security group is a named set of ingress and egress rules in a
# VPC. We authorize ports 22 (ssh), 80 (http), and 443 (https).
# Parameters:
#
# SECGROUP_NAME
# Name of the security group.
#
# SECGROUP_DESC
# Description of the security group.
SECGROUP_NAME = probcomp/secgroups-testing/$(PROJECT)
SECGROUP_DESC = $(SECGROUP_NAME)
secgroup.json: vpc.json
-rm -f [email protected]
vpc_id=`jq -r .Vpc.VpcId < vpc.json` && \
$(AWSCLI) ec2 create-security-group \
--description '$(SECGROUP_DESC)' \
--group-name '$(SECGROUP_NAME)' \
--vpc-id "$$vpc_id" \
group_id=`jq -r .GroupId < [email protected]` && \
$(TAG_PROJECT) "$$group_id" && \
$(TAG_NAME) "$$group_id" && \
$(AWSCLI) ec2 authorize-security-group-ingress \
--cidr 0.0.0.0/0 \
--group-id "$$group_id" \
--port 22 \
--protocol tcp \
&& \
$(AWSCLI) ec2 authorize-security-group-ingress \
--cidr 0.0.0.0/0 \
--group-id "$$group_id" \
--port 80 \
--protocol tcp \
&& \
$(AWSCLI) ec2 authorize-security-group-ingress \
--cidr 0.0.0.0/0 \
--group-id "$$group_id" \
--port 443 \
--protocol tcp \
# end of authorize-security-group-ingress options
mv -f [email protected] $@
DESCRIBE_SECGROUPS = $(AWSCLI) ec2 describe-security-groups $(FILTER_PROJECT)
describe-secgroups: .PHONY
@$(DESCRIBE_SECGROUPS)
LIST_SECGROUPS = $(DESCRIBE_SECGROUPS) | jq -r '.SecurityGroups[].GroupId'
list-secgroups: .PHONY
@$(LIST_SECGROUPS)
clean: _clean-secgroups
_clean-secgroups: .PHONY
_clean-secgroups: _clean-instances
$(MAKE) clean-secgroups
clean-secgroups: .PHONY
@echo '#' WARNING: May fail if there are still instances in use.
$(LIST_SECGROUPS) \
| while read id; do \
$(AWSCLI) ec2 delete-security-group \
--group-id "$$id"; \
done
-rm -f secgroup.json
###############################################################################
# Route table
#
# Automatically created for the VPC, we just need to get its id.
routetab.json: vpc.json
-rm -f [email protected]
vpc_id=`jq -r .Vpc.VpcId < vpc.json` && \
$(AWSCLI) ec2 describe-route-tables \
--filters Name=vpc-id,Values="$$vpc_id" \
| jq '{"RouteTable": .RouteTables[0]}' > [email protected]
mv -f [email protected] $@
DESCRIBE_ROUTETABS = \
vpc_ids=`$(LIST_VPCS)` && \
vpc_ids_comma=`echo "$$vpc_ids" | tr \\n , | head -c -1` && \
$(AWSCLI) ec2 describe-route-tables \
--filters Name=vpc-id,Values="$$vpc_ids_comma"
describe-routetabs: .PHONY
@$(DESCRIBE_ROUTETABS)
LIST_ROUTETABS = $(DESCRIBE_ROUTETABS) | jq -r '.RouteTables[].RouteTableId'
list-routetabs: .PHONY
@$(LIST_ROUTETABS)
clean: clean-routetabs
clean-routetabs: .PHONY
-rm -f routetab.json
###############################################################################
# Subnet
#
# A subnet is a section of address space in a VPC from which an EC2
# instance's IP address may be drawn.
# Parameters:
#
# SUBNET_CIDR_BLOCK
# Private IPv4 address range for the subnet within
# VPC_CIDR_BLOCK.
SUBNET_CIDR_BLOCK = 10.0.0.0/24
subnet.json: vpc.json
-rm -f [email protected]
vpc_id=`jq -r .Vpc.VpcId < vpc.json` && \
$(AWSCLI) ec2 create-subnet \
--cidr-block $(SUBNET_CIDR_BLOCK) \
--vpc-id "$$vpc_id" \
subnet_id=`jq -r .Subnet.SubnetId < [email protected]` && \
$(TAG_PROJECT) "$$subnet_id" && \
$(TAG_NAME) "$$subnet_id"
mv -f [email protected] $@
DESCRIBE_SUBNETS = $(AWSCLI) ec2 describe-subnets $(FILTER_PROJECT)
describe-subnets: .PHONY
@$(DESCRIBE_SUBNETS)
LIST_SUBNETS = $(DESCRIBE_SUBNETS) | jq -r '.Subnets[].SubnetId'
list-subnets: .PHONY
@$(LIST_SUBNETS)
clean: _clean-subnets
_clean-subnets: .PHONY
_clean-subnets: _clean-instances
#_clean-subnets: _clean-rtassocs
$(MAKE) clean-subnets
clean-subnets: .PHONY
@echo '#' WARNING: May fail if there are still instances in use.
$(LIST_SUBNETS) \
| while read id; do \
$(AWSCLI) ec2 delete-subnet --subnet-id "$$id"; \
done
-rm -f subnet.json
###############################################################################
# Route table association
#
# A route table association is necessary for a subnet to reach other
# networks. There is no actual information here. Why it is necessary
# is currently beyond my sleep-addled me.
rtassoc.json: routetab.json
rtassoc.json: subnet.json
rtassoc.json: vpc.json
-rm -f [email protected]
routetab_id=`jq -r .RouteTable.RouteTableId < routetab.json` && \
subnet_id=`jq -r .Subnet.SubnetId < subnet.json` && \
$(AWSCLI) ec2 associate-route-table \
--route-table-id "$$routetab_id" \
--subnet-id "$$subnet_id" \
mv -f [email protected] $@
DESCRIBE_RTASSOCS = \
$(DESCRIBE_ROUTETABS) | jq '[.RouteTables[].Associations[]]'
describe-rtassocs: .PHONY
@$(DESCRIBE_RTASSOCS)
LIST_RTASSOCS = $(DESCRIBE_RTASSOCS) | jq -r '.[].RouteTableAssociationId'
list-rtassocs: .PHONY
@$(LIST_RTASSOCS)
#clean: _clean-rtassocs
_clean-rtassocs: .PHONY
$(MAKE) clean-rtassocs
clean-rtassocs: .PHONY
$(LIST_RTASSOCS) \
| while read id; do \
$(AWSCLI) ec2 disassociate-route-table \
--association-id "$$id"; \
done
-rm -f rtassoc.json
###############################################################################
# Gateway
#
# A gateway is a nexus to the outside world. The outside world is a
# scary place. Presumably this is why you must explicitly opt in to
# having a nexus to it. Otherwise there is no semantic content to
# this either.
gateway.json: routetab.json
gateway.json: vpc.json
-rm -f [email protected]
$(AWSCLI) ec2 create-internet-gateway > [email protected]
gateway_id=`jq -r .InternetGateway.InternetGatewayId < [email protected]` && \
$(TAG_PROJECT) "$$gateway_id" && \
$(TAG_NAME) "$$gateway_id" && \
vpc_id=`jq -r .Vpc.VpcId < vpc.json` && \
$(AWSCLI) ec2 attach-internet-gateway \
--internet-gateway-id "$$gateway_id" \
--vpc-id "$$vpc_id" \
&& \
routetab_id=`jq -r .RouteTable.RouteTableId < routetab.json` && \
$(AWSCLI) ec2 create-route \
--destination-cidr-block 0.0.0.0/0 \
--gateway-id "$$gateway_id" \
--route-table-id "$$routetab_id" \
# end of create-route options
mv -f [email protected] $@
DESCRIBE_GATEWAYS = \
$(AWSCLI) ec2 describe-internet-gateways $(FILTER_PROJECT)
describe-gateways: .PHONY
@$(DESCRIBE_GATEWAYS)
LIST_GATEWAYS = \
$(DESCRIBE_GATEWAYS) | jq -r '.InternetGateways[].InternetGatewayId'
list-gateways: .PHONY
@$(LIST_GATEWAYS)
clean: _clean-gateways
_clean-gateways: .PHONY
_clean-gateways: _clean-instances
$(MAKE) clean-gateways
clean-gateways: .PHONY
$(LIST_GATEWAYS) \
| while read id; do \
$(LIST_VPCS) \
| while read vpc_id; do \
$(AWSCLI) ec2 detach-internet-gateway \
--internet-gateway-id "$$id" \
--vpc-id "$$vpc_id"; \
done && \
if routetab_id=`jq -r .RouteTable.RouteTableId < routetab.json`; then \
$(AWSCLI) ec2 delete-route \
--route-table-id "$$routetab_id" \
--destination-cidr-block 0.0.0.0/0; \
fi && \
$(AWSCLI) ec2 delete-internet-gateway \
--internet-gateway-id "$$id"; \
done
-rm -f gateway.json
###############################################################################
# Instances and reservation
#
# A reservation is a collection of related instances. An instance is
# a magic computer that lives in the cloud and plays the harp.
# Parameters:
#
# AMI_ID
# Id (`ami-...') of the AMI on which the AMI we are about to
# create is based.
#
# INSTANCE_TYPE
# EC2 instance type.
#
# KEY_NAME
# Name of the ssh identity.
#
# KEY_FILE
# Path to private key for the ssh identity.
# ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-20170414
AMI_ID = ami-80861296
INSTANCE_TYPE = t2.micro
KEY_NAME = $(PROJECT)
KEY_FILE = $(KEY_NAME).pem
reservation.json: secgroup.json
reservation.json: subnet.json
-rm -f [email protected]
secgroup_id=`jq -r .GroupId < secgroup.json` && \
subnet_id=`jq -r .Subnet.SubnetId < subnet.json` && \
$(AWSCLI) ec2 run-instances \
--associate-public-ip-address \
--count 1 \
--image-id $(AMI_ID) \
--instance-type t2.micro \
--key-name $(KEY_NAME) \
--security-group-ids "$$secgroup_id" \
--subnet-id "$$subnet_id" \
> [email protected] && \
instance_ids=`jq -r '.Instances[].InstanceId' < [email protected]` && \
$(TAG_PROJECT) $$instance_ids && \
$(AWSCLI) ec2 create-tags \
--tags Key=Name,Value=$(PROJECT) \
--resources $$instance_ids
mv -f [email protected] $@
# No dependency on bootwait.sh even though we use it, since
# (a) it doesn't materially affect the output, and
# (b) it is not autogenerated.
instance.json: reservation.json
-rm -f [email protected]
instance_ids=`jq -r '.Instances[].InstanceId' < reservation.json` && \
sh bootwait.sh \
$(AWSCLI) ec2 describe-instance-status \
--instance-ids $$instance_ids \
&& \
$(AWSCLI) ec2 describe-instances \
--instance-ids $$instance_ids \
| jq '.Reservations[0].Instances[0]' > [email protected]
mv -f [email protected] $@
DESCRIBE_INSTANCES = $(AWSCLI) ec2 describe-instances $(FILTER_PROJECT)
describe-instances: .PHONY
@$(DESCRIBE_INSTANCES)
LIST_INSTANCES = \
$(DESCRIBE_INSTANCES) | jq -r '.Reservations[].Instances[].InstanceId'
list-instances: .PHONY
@$(LIST_INSTANCES)
clean: _clean-instances
_clean-instances: .PHONY
$(MAKE) clean-instances
clean-instances: .PHONY
$(LIST_INSTANCES) \
| xargs -r $(AWSCLI) ec2 terminate-instances --instance-ids
-rm -f instance.json
-rm -f reservation.json
###############################################################################
# ssh known hosts
#
# Works only on first boot!
#
# XXX Also only works a couple minutes after the first boot. Whisky
# tango foxtrot?
known_hosts: instance.json
-rm -f [email protected]
instance_id=`jq -r .InstanceId < instance.json` && \
ip_addr=`jq -r .PublicIpAddress < instance.json` && \
sh conswait.sh \
$(AWSCLI) ec2 get-console-output \
--instance-id "$$instance_id" && \
$(AWSCLI) ec2 get-console-output \
--instance-id "$$instance_id" \
| jq -r .Output \
| tr -d '\r' \
| awk -v hostname="$$ip_addr" \
'/^-----BEGIN SSH HOST KEY KEYS-----$$/,/^-----END SSH HOST KEY KEYS-----$$/ { print hostname, $$1, $$2 }' \
| tail -n +2 | head -n -1 \
mv -f [email protected] $@
clean: clean-known_hosts
clean-known_hosts: .PHONY
-rm -f known_hosts
###############################################################################
# Setup
setup.stamp: gateway.json
setup.stamp: instance.json
setup.stamp: known_hosts
#setup.stamp: rtassoc.json
setup.stamp: setup.sh
-rm -f [email protected]
ip_addr=`jq -r '.PublicIpAddress' < instance.json` && \
$(SSH) -i $(KEY_FILE) -o UserKnownHostsFile=known_hosts \
ubuntu@"$$ip_addr" \
'sh -x' < setup.sh
touch [email protected]
mv -f [email protected] $@
clean: clean-setup.stamp
clean-setup.stamp: .PHONY
-rm -f setup.stamp
###############################################################################
# AMI
# Parameters:
#
# AMI_REV
# Revision number of resulting AMI for default AMI_NAME.
#
# AMI_NAME
# Name of the resulting AMI.
AMI_REV = 1
AMI_NAME = probcomp/images-testing/$(PROJECT)-$(AMI_REV)
ami.json: reservation.json
ami.json: setup.stamp
-rm -f [email protected]
instance_id=`jq -r '.Instances[0].InstanceId' < reservation.json` && \
$(AWSCLI) ec2 create-image \
--instance-id "$$instance_id" \
--name $(AMI_NAME) \
> [email protected] && \
image_id=`jq -r .ImageId < [email protected]` && \
$(TAG_PROJECT) "$$image_id"
mv -f [email protected] $@
DESCRIBE_AMIS = $(AWSCLI) ec2 describe-images $(FILTER_PROJECT)
describe-amis: .PHONY
@$(DESCRIBE_AMIS)
LIST_AMIS = $(DESCRIBE_AMIS) | jq -r '.Images[].ImageId'
list-amis: .PHONY
@$(LIST_AMIS)
distclean: _clean-amis
_clean-amis: .PHONY
$(MAKE) clean-amis
clean-amis: .PHONY
$(LIST_AMIS) \
| while read id; do \
$(AWSCLI) ec2 deregister-image --image-id "$$id"; \
done
-rm -f ami.json
ami.stamp: ami.json
image_id=`jq -r .ImageId < ami.json` && \
sh amiwait.sh \
$(AWSCLI) ec2 describe-images --image-ids "$$image_id"
touch $@
ami: .PHONY
ami: ami.stamp
###############################################################################
# Test instance
TEST_INSTANCE_TYPE = $(INSTANCE_TYPE)
TEST_HOSTNAME = please.set.me.to.something.example.com
test: .PHONY
test: test-assoc.json
test: test-known_hosts
# XXX Can't tag address allocations??
test-address.json:
-rm -f [email protected]
$(AWSCLI) ec2 allocate-address --domain vpc > [email protected]
mv -f [email protected] $@
release-test-address: .PHONY
if addr_id=`jq -r .AllocationId < [email protected]`; then \
$(AWSCLI) ec2 release-address --allocation-id "$$addr_id"; \
done
-rm -f test-address.json
test-res.json: ami.stamp
-rm -f [email protected]
image_id=`jq -r .ImageId < ami.json` && \
secgroup_id=`jq -r .GroupId < secgroup.json` && \
subnet_id=`jq -r .Subnet.SubnetId < subnet.json` && \
$(AWSCLI) ec2 run-instances \
--count 1 \
--image-id "$$image_id" \
--instance-type $(TEST_INSTANCE_TYPE) \
--key-name $(KEY_NAME) \
--security-group-ids "$$secgroup_id" \
--subnet-id "$$subnet_id" \
instance_ids=`jq -r '.Instances[].InstanceId' < [email protected]` && \
$(TAG_PROJECT) $$instance_ids && \
$(AWSCLI) ec2 create-tags \
--tags Key=Name,Value=$(PROJECT)-test \
--resources $$instance_ids
mv -f [email protected] $@
test-assoc.json: test-address.json
test-assoc.json: test-instance.json
-rm -f [email protected]
addr_id=`jq -r .AllocationId < test-address.json` && \
instance_id=`jq -r '.Instances[].InstanceId' < test-res.json` && \
$(AWSCLI) ec2 associate-address \
--allocation-id "$$addr_id" \
--instance-id "$$instance_id" \
mv -f [email protected] $@
test-instance.json: test-res.json
-rm -f [email protected]
instance_ids=`jq -r '.Instances[].InstanceId' < test-res.json` && \
sh bootwait.sh \
$(AWSCLI) ec2 describe-instance-status \
--instance-ids $$instance_ids \
&& \
$(AWSCLI) ec2 describe-instances \
--instance-ids $$instance_ids \
| jq '.Reservations[0].Instances[0]' > [email protected]
mv -f [email protected] $@
test-known_hosts: test-address.json
test-known_hosts: test-instance.json
-rm -f [email protected]
instance_id=`jq -r .InstanceId < test-instance.json` && \
ip_addr=`jq -r .PublicIp < test-address.json` && \
sh conswait.sh \
$(AWSCLI) ec2 get-console-output \
--instance-id "$$instance_id" && \
$(AWSCLI) ec2 get-console-output \
--instance-id "$$instance_id" \
| jq -r .Output \
| tr -d '\r' \
| awk -v hostname=$(TEST_HOSTNAME) -v ip_addr="$$ip_addr" \
'/^-----BEGIN SSH HOST KEY KEYS-----$$/,/^-----END SSH HOST KEY KEYS-----$$/ { print hostname "," ip_addr, $$1, $$2 }' \
| tail -n +2 | head -n -1 \
mv -f [email protected] $@
test-start: .PHONY
instance_ids=`jq -r '.Instances[].InstanceId' < test-res.json` && \
$(AWSCLI) ec2 start-instances --instance-ids $$instance_ids
test-resize: .PHONY
instance_ids=`jq -r '.Instances[].InstanceId' < test-res.json` && \
for instance_id in $$instance_ids; do \
$(AWSCLI) ec2 modify-instance-attribute \
--instance-id "$$instance_id" \
--instance-type $(TEST_INSTANCE_TYPE) \
; \
done
test-stop: .PHONY
instance_ids=`jq -r '.Instances[].InstanceId' < test-res.json` && \
$(AWSCLI) ec2 stop-instances --instance-ids $$instance_ids
test-status: .PHONY
instance_ids=`jq -r '.Instances[].InstanceId' < test-res.json` && \
$(AWSCLI) ec2 describe-instance-status --instance-ids $$instance_ids
test-describe: .PHONY
instance_ids=`jq -r '.Instances[].InstanceId' < test-res.json` && \
$(AWSCLI) ec2 describe-instances --instance-ids $$instance_ids