forked from cloudfoundry/docs-bosh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli-v2.html.md.erb
1022 lines (697 loc) · 39.5 KB
/
cli-v2.html.md.erb
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
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
title: CLI v2
---
<p class="note">Note: Applies to CLI v2 v2.0.16+.</p>
The BOSH Command Line Interface (CLI) is what you use to run BOSH commands. CLI v2 is a new major version of CLI.
---
## <a id="install"></a> Install
1. Download the binary for your platform and place it on your `PATH`:
- [bosh-cli-2.0.44-darwin-amd64](https://s3.amazonaws.com/bosh-cli-artifacts/bosh-cli-2.0.44-darwin-amd64) <span class="sha1">sha1: 6229e5ff11134763c05dda254c47cd24a40007ce</span>
- [bosh-cli-2.0.44-linux-amd64](https://s3.amazonaws.com/bosh-cli-artifacts/bosh-cli-2.0.44-linux-amd64) <span class="sha1">sha1: 228daf994006d77fe484b0246085fde55c86b4f2</span>
- [bosh-cli-2.0.44-windows-amd64.exe](https://s3.amazonaws.com/bosh-cli-artifacts/bosh-cli-2.0.44-windows-amd64.exe) <span class="sha1">sha1: fa1cbdc5f82c95924cbad0e91d86158a35e16c20</span> (Windows CLI support is partial)
<pre class="terminal">
$ chmod +x ~/Downloads/bosh-cli-*
$ sudo mv ~/Downloads/bosh-cli-* /usr/local/bin/bosh
</pre>
1. Check `bosh` version to make sure it is properly installed:
<pre class="terminal">
$ bosh -v
version 2.0.44-21639e8-2017-10-17T18:49:44Z
</pre>
If the output does not begin with `version 2.0...` you are probably executing CLI v1 (Ruby based).
1. [Install OS specified dependencies](cli-env-deps.html) for `bosh create-env` command
Alternatively, refer to [cloudfoundry/homebrew-tap](https://github.com/cloudfoundry/homebrew-tap) to install CLI via Homebrew on OS X. We currently do not publish CLI via apt or yum repositories.
---
## <a id="global-falgs"></a> Global Flags
See [Global flags](cli-global-flags.html) for more details on how to enable different output formats, debug logging, etc.
---
## <a id="cmds"></a> Commands
### <a id="env-mgmt"></a> Environments
See [Environments](cli-envs.html).
- <a id="environments"></a> `bosh environments` (Alias: `envs`)
Lists aliased environments known to the CLI. Aliasing is done via `alias-env` command.
<pre class="terminal">
$ bosh envs
URL Alias
104.154.171.255 gcp
192.168.56.6 vbox
2 environments
Succeeded
</pre>
- <a id="create-env"></a> `bosh create-env manifest.yml [--state path] [-v ...] [-o ...] [--vars-store path]`
Creates single VM based on the manifest. Typically used to create a Director environment. Operation files and variables can be provided to adjust and fill in manifest before doing a deploy.
`create-env` command replaces `bosh-init deploy` CLI command.
<pre class="terminal">
$ bosh create-env ~/workspace/bosh-deployment/bosh.yml \
--state state.json \
--vars-store ./creds.yml \
-o ~/workspace/bosh-deployment/virtualbox/cpi.yml \
-o ~/workspace/bosh-deployment/virtualbox/outbound-network.yml \
-o ~/workspace/bosh-deployment/bosh-lite.yml \
-o ~/workspace/bosh-deployment/jumpbox-user.yml \
-v director_name=vbox \
-v internal_ip=192.168.56.6 \
-v internal_gw=192.168.56.1 \
-v internal_cidr=192.168.56.0/24 \
-v network_name=vboxnet0 \
-v outbound_network_name=NatNetwork
</pre>
- <a id="alias-env"></a> `bosh alias-env name -e location [--ca-cert=path]`
Assigns a name to the created environment for easier access in subsequent CLI commands. Instead of specifying Director location and possibly a CA certificate, subsequent commands can just take given name via `--environment` flag (`-e`).
<pre class="terminal">
$ bosh alias-env gcp -e bosh.corp.com
$ bosh alias-env gcp -e 10.0.0.6 --ca-cert <(bosh int creds.yml --path /director_ssl/ca)
</pre>
- <a id="environment"></a> `bosh -e location environment` (Alias: `env`)
Shows Director information in the deployment environment.
<pre class="terminal">
$ bosh -e vbox env
Using environment '192.168.56.6' as '?'
Name vbox
UUID eeb27cc6-467e-4c1d-a8f9-f1a8de759f52
Version 260.5.0 (00000000)
CPI warden_cpi
Features compiled_package_cache: disabled
dns: disabled
snapshots: disabled
User admin
Succeeded
</pre>
- <a id="delete-env"></a> `bosh delete-env manifest.yml [--state path] [-v ...] [-o ...] [--vars-store path]`
Deletes previously created VM based on the manifest. Same flags provided to `create-env` command should be given to the `delete-env` command.
`delete-env` command replaces `bosh-init delete` CLI command.
<pre class="terminal">
$ bosh delete-env ~/workspace/bosh-deployment/bosh.yml \
--state state.json \
--vars-store ./creds.yml \
-o ~/workspace/bosh-deployment/virtualbox/cpi.yml \
-o ~/workspace/bosh-deployment/virtualbox/outbound-network.yml \
-o ~/workspace/bosh-deployment/bosh-lite.yml \
-o ~/workspace/bosh-deployment/jumpbox-user.yml \
-v director_name=vbox \
-v internal_ip=192.168.56.6 \
-v internal_gw=192.168.56.1 \
-v internal_cidr=192.168.56.0/24 \
-v network_name=vboxnet0 \
-v outbound_network_name=NatNetwork
</pre>
---
### <a id="session-mgmt"></a> Session
- <a id="log-in"></a> `bosh log-in` (Alias: `l`, `login`)
Logs in given user into the Director.
This command can only be used interactively. If non-interactive use is necessary (for example in scripts) please set `BOSH_CLIENT` and `BOSH_CLIENT_SECRET` environment variables instead of using this command. Note that if the Director is configured with UAA authentication you cannot use UAA users with BOSH_* environment variables but rather have to use UAA clients.
<pre class="terminal">
$ bosh -e my-env l
User (): admin
Password ():
</pre>
- <a id="log-out"></a> `bosh log-out` (Alias: `logout`)
Logs out currently logged in user.
---
### <a id="stemcell-mgmt"></a> Stemcells
See [Uploading Stemcells](uploading-stemcells.html).
- <a id="stemcells"></a> `bosh -e my-env stemcells` (Alias: `ss`)
Lists stemcells previously uploaded into the Director. Shows their names, versions and CIDs.
<pre class="terminal">
$ bosh -e my-env ss
Using environment '192.168.56.6' as '?'
Name Version OS CPI CID
bosh-warden-boshlite-ubuntu-trusty-go_agent 3363* ubuntu-trusty - 6cbb176a-6a43-42...
~ 3312 ubuntu-trusty - 43r3496a-4rt3-52...
bosh-warden-boshlite-centos-7-go_agent 3363* centos-7 - 38yr83gg-349r-94...
(*) Currently deployed
3 stemcells
Succeeded
</pre>
- <a id="upload-stemcell"></a> `bosh -e my-env upload-stemcell location [--sha1=digest] [--fix]` (Alias: `us`)
Uploads stemcell to the Director. Succeedes even if stemcell is already imported.
Stemcell location may be local file system path or an HTTP/HTTPS URL.
`--fix` flag allows to replace previously uploaded stemcell with the same name and version to repair stemcells that might have been corrupted in the cloud.
<pre class="terminal">
$ bosh -e my-env us ~/Downloads/bosh-stemcell-3363-warden-boshlite-ubuntu-trusty-go_agent.tgz
$ bosh -e my-env us https://bosh.io/d/stemcells/bosh-stemcell-warden-boshlite-ubuntu-trusty-go_agent?v=3363
</pre>
- <a id="delete-stemcell"></a> `bosh -e my-env delete-stemcell name/version`
Deletes uploaded stemcell from the Director. Succeedes even if stemcell is not found.
<pre class="terminal">
$ bosh -e my-env delete-stemcell bosh-warden-boshlite-ubuntu-trusty-go_agent/3363
</pre>
- <a id="repack-stemcell"></a> `bosh repack-stemcell src.tgz dst.tgz [--name=name] [--version=ver] [--cloud-properties=json-string]`
Produces new stemcell tarball with updated properties such as name, version, and cloud properties.
See [Repacking stemcells](repack-stemcell.html) for details.
---
### <a id="release-creation"></a> Release creation
- <a id="init-release"></a> `bosh init-release [--git] [--dir=dir]`
Creates an empty release skeleton for a release in `dir`. By default `dir` is the current directory.
`--git` flag initializes release skeleton as a Git repository, adding appropriate `.gitignore` file.
<pre class="terminal">
$ bosh init-release --git --dir release-dir
$ cd release-dir
</pre>
- <a id="generate-job"></a> `bosh generate-job name [--dir=dir]`
Creates an empty job skeleton for a release in `dir`. Includes bare `spec` and an empty `monit` file.
- <a id="generate-package"></a> `bosh generate-package name [--dir=dir]`
Creates an empty package skeleton for a release in `dir`. Includes bare `spec` and an empty `packaging` file.
- <a id="vendor-package"></a> `bosh vendor-package name src-dir [--dir=dir]` (v2.0.36+)
Vendors a package from a different release into a release in `dir`. It includes `spec.lock` in the package directory so that CLI will reference specific package by its fingerprint when creating releases.
See [Package vendoring](package-vendoring.html) for details.
- <a id="create-release"></a> `bosh create-release [--force] [--version=ver] [--timestamp-version] [--final] [--tarball=path] [--dir=dir]` (Alias: `cr`)
Creates new version of a release stored in `dir`
- `--force` flag specifies to ignore uncommitted changes in the release directory; it should only be used when building dev releases
- `--version` flag allows to provide custom release version
- `--timestamp-version` flag will produce timestamp based dev release version
- `--tarball` flag specifies destination of a release tarball; if not specified, release tarball will not be produced
- `--sha2` flag to use SHA256 checksum
While iterating on a release it's common to run `bosh create-release --force && bosh -e my-env upload-release && bosh -e my-env -d my-dep deploy manifest.yml` command sequence.
In a CI pipeline it's common to use this command to create a release tarball and pass it into acceptance or end-to-end tests. Once release tarball goes through appropriate tests it can be finalized with a `finalize-release` command and shared with release consumers.
<pre class="terminal">
$ cd release-dir
$ bosh create-release --force
$ bosh create-release --timestamp-version
$ bosh create-release --version 9+dev.10
$ bosh create-release --tarball /tmp/my-release.tgz
$ bosh create-release --final
$ bosh create-release --version 20 --final
$ bosh create-release releases/zookeeper/zookeeper-3.yml --tarball /tmp/my-release.tgz
</pre>
- <a id="finalize-release"></a> `bosh finalize-release release.tgz [--force] [--version=ver] [--dir=dir]`
Records contents of a release tarball as a final release with an optionally given version. Once `.final_builds` and `releases` directories are updated, it's strongly recommend to commit your changes to version control.
Typically this command is used as a final step in the CI pipeline to save the final artifact once it passed appropriate tests.
<pre class="terminal">
$ cd release-dir
$ bosh finalize-release /tmp/my-release.tgz
$ bosh finalize-release /tmp/my-release.tgz --version 20
$ git commit -am 'Final release 20'
$ git push origin master
</pre>
- <a id="reset-release"></a> `bosh reset-release [--dir=dir]`
Removes temporary artifacts such as dev releases, blobs, etc. kept in the release directory `dir`.
---
### <a id="blob-mgmt"></a> Release blobs
See [Release Blobs](release-blobs.html) for a detailed workflow.
- <a id="blobs"></a> `bosh blobs`
Lists tracked blobs from `config/blobs.yml`. Shows uploaded and not-yet-uploaded blobs.
<pre class="terminal">
$ cd release-dir
$ bosh blobs
Path Size Blobstore ID Digest
golang/go1.6.2.linux-amd64.tar.gz 81 MiB f1833f76-ad8b-4b... b8318b0...
stress/stress-1.0.4.tar.gz 187 KiB (local) e1533bc...
2 blobs
Succeeded
</pre>
- <a id="add-blob"></a> `bosh add-blob src-path dst-path`
Sarts tracking blob in `config/blobs.yml` for inclusion in packages.
<pre class="terminal">
$ cd release-dir
$ bosh add-blob ~/Downloads/stress-1.0.4.tar.gz stress/stress-1.0.4.tar.gz
</pre>
- <a id="remove-blob"></a> `bosh remove-blob blob-path`
Stops tracking blob in `config/blobs.yml`. Does not remove previously uploaded copies from the blobstore as older release versions may still want to reference it.
<pre class="terminal">
$ cd release-dir
$ bosh remove-blob stress/stress-1.0.4.tar.gz
</pre>
- <a id="upload-blob"></a> `bosh upload-blobs`
Uploads previously added blobs that were not yet uploaded to the blobstore. Updates `config/blobs.yml` with returned blobstore IDs. Before creating a final release it's strongly recommended to upload blobs so that other release contributors can rebuild a release from scratch.
<pre class="terminal">
$ cd release-dir
$ bosh upload-blobs
</pre>
- <a id="sync-blob"></a> `bosh sync-blobs`
Downloads blobs into `blobs/` based on `config/blobs.yml`.
<pre class="terminal">
$ cd release-dir
$ bosh sync-blobs
</pre>
---
### <a id="release-mgmt"></a> Releases
See [Uploading Releases](uploading-releases.html).
- <a id="releases"></a> `bosh -e my-env releases` (Alias: `rs`)
Lists releases previously uploaded into the Director. Shows their names and versions.
<pre class="terminal">
$ bosh -e my-env rs
Using environment '192.168.56.6' as client 'admin'
Name Version Commit Hash
capi 1.21.0* 716aa812
cf-mysql 34* e0508b5
cf-smoke-tests 11* a6dad6e
cflinuxfs2-rootfs 1.52.0* 4827ef51+
consul 155* 22515a98+
diego 1.8.1* 0cca668e
dns 3* 57e27da
etcd 94* 57c81e16
garden-runc 1.2.0* 2b3dedc5
loggregator 78* 773a3ba
nats 15* d4dfc4c1+
routing 0.145.0* dfb44c41+
statsd-injector 1.0.20* 552926d
syslog 9 ac2172f
uaa 25* 86ec7568
(*) Currently deployed
(+) Uncommitted changes
15 releases
Succeeded
</pre>
- <a id="upload-release"></a> `bosh -e my-env upload-release [location] [--version=ver] [--sha1=digest] [--fix]` (Alias: `ur`)
Uploads release to the Director. Succeedes even if release is already imported.
Release location may be local file system path, HTTP/HTTPS URL or a git URL.
`--fix` flag allows to replace previously uploaded release with the same name and version to repair releases that might have been corrupted.
<pre class="terminal">
$ bosh -e my-env ur
$ bosh -e my-env ur https://bosh.io/d/github.com/concourse/concourse?v=2.7.3
$ bosh -e my-env ur git+https://github.com/concourse/concourse --version 2.7.3
</pre>
- <a id="delete-release"></a> `bosh -e my-env delete-release name/version`
Deletes uploaded release from the Director. Succeedes even if release is not found.
<pre class="terminal">
$ bosh -e my-env delete-release cf-smoke-tests/94
</pre>
- <a id="export-release"></a> `bosh -e my-env -d my-dep export-release name/version os/version [--dir=dir]`
Compiles and exports a release against a particular stemcell version.
Requires to operate with a deployment so that compilation resources (VMs) are properly tracked.
Destination directory default to the current directory.
<pre class="terminal">
$ bosh -e my-env -d my-dep export-release cf-smoke-tests/94 ubuntu-trusty/3369
</pre>
- <a id="inspect-release"></a> `bosh -e my-env inspect-release name/version`
Lists all jobs, job metadata (such as links), packages, and compiled packages associated with a release version.
<pre class="terminal extra-wide">
$ bosh -e gcp-test inspect-release consul/155
Using environment '192.168.56.6' as client 'admin'
Job Blobstore ID Digest Links Consumed Links Provided
acceptance-tests/943c6083581e623dc66c7d9126d8e5989c4c2b31 0f3cd013-1d3d-... 17e5e4fc... - -
consul-test-consumer-windows/6748c0675da2292c680da03e89b738a9d5818370 7461c74c-745d-... 9809861c... - -
consul-test-consumer/7263db87ba85eaf0dd41bd198359c8597e961839 8bde4572-8e8b-... 7b08b059... - -
consul_agent/b4872109282347700eaa884dcfe93f3a03dc22dd e41f705e-2cb7-... a8db2c76... - name: consul - name: consul
type: consul type: consul
optional: true
consul_agent_windows/a0b91cb0aa1029734d77fcf064dafdb67f14ada6 3a8755d0-7a39-... 17f07ec0... - name: consul - name: consul
type: consul type: consul
optional: true
fake-dns-server/a1ea5f64de0860512470ace7ce2376aa9470f9b1 5bb53f17-eba9-... 0565f9af... - -
6 jobs
Package Compiled for Blobstore ID Digest
acceptance-tests-windows/e36cef763e5cfd4e28738ad314807e6d1e13b960 (source) 03589024-2596-49fc-... 96eaaf4ba...
acceptance-tests/9d56ac03d7410dcdfd96a8c96bbc79eb4b53c864 (source) 79fb9ba7-cd23-4b93-... e08ee88f5...
confab-windows/52b117effcd95138eca94c789530bcd6499cff9d (source) 53d4b206-b064-462d-... 43f92c8d0...
confab/b2ff0bbd68b7d600ecb1ffaf41f59af073e894fd (source) b93214eb-a816-4029-... 4b627d264...
~ ubuntu-trusty/3363.9 f66fe541-8c21-4fe3-... 8e662c2e2...
consul-windows/2a8e0b7ce1424d1d5efe5c7184791481a0c26424 (source) 9516870b-801e-42ea-... 19db18127...
consul/6049d3016cd34ac64ccbf7837b06b6db81942102 (source) 04aa38af-e883-4842-... c42cacfc7...
~ ubuntu-trusty/3363.9 ab4afda6-881e-46b1-... 27c1390fa...
golang1.7-windows/1a80382e081cd429cf518f0c783f4e4172cac79e (source) d7670210-7038-4749-... b91caa06a...
golang1.7/181f7537c2ec17ac2406d9f2eb3322fd80fa2a1c (source) ac8aa36a-8965-46e9-... ca440d716...
~ ubuntu-trusty/3363.9 9d40794f-0c50-4d0c-... 9d6e29221...
11 packages
Succeeded
</pre>
---
### <a id="cloud-config-mgmt"></a> Cloud config
See [Cloud config](cloud-config.html).
- <a id="cloud-config"></a> `bosh -e my-env cloud-config` (Alias: `cc`)
Show current cloud config on the Director.
- <a id="update-cloud-config"></a> `bosh -e my-env update-cloud-config config.yml [-v ...] [-o ...]` (Alias: `ucc`)
Update current cloud config on the Director.
<pre class="terminal">
$ bosh -e my-env ucc cc.yml
</pre>
---
### <a id="runtime-config-mgmt"></a> Runtime config
See [Runtime config](runtime-config.html).
- <a id="runtime-config"></a> `bosh -e my-env runtime-config` (Alias: `rc`)
Show current runtime config on the Director.
- <a id="update-runtime-config"></a> `bosh -e my-env update-runtime-config config.yml [-v ...] [-o ...]` (Alias: `urc`)
Update current runtime config on the Director.
<pre class="terminal">
$ bosh -e my-env urc runtime.yml
</pre>
---
### <a id="cpi-config-mgmt"></a> CPI config
See [CPI config](cpi-config.html).
- <a id="cpi-config"></a> `bosh -e my-env cpi-config`
Show current CPI config on the Director.
- <a id="update-cpi-config"></a> `bosh -e my-env update-cpi-config config.yml [-v ...] [-o ...]`
Update current CPI config on the Director.
<pre class="terminal">
$ bosh -e my-env update-cpi-config cpis.yml
</pre>
---
### <a id="deployment-mgmt"></a> Deployments
- <a id="deployments"></a> `bosh -e my-env deployments` (Alias: `ds`)
Lists deployments tracked by the Director. Shows their names, used releases and stemcells.
<pre class="terminal extra-wide">
$ bosh -e my-env ds
Using environment '192.168.56.6' as client 'admin'
Name Release(s) Stemcell(s) Team(s) Cloud Config
cf binary-buildpack/1.0.9 bosh-warden-boshlite-ubuntu-trusty-go_agent/3363.9 - latest
capi/1.21.0
cf-mysql/34
cf-smoke-tests/11
cflinuxfs2-rootfs/1.52.0
consul/155
diego/1.8.1
etcd/94
garden-runc/1.2.0
loggregator/78
nats/15
routing/0.145.0
statsd-injector/1.0.20
uaa/25
service-instance_0d4140a0-42b7-... mysql/0.6.0 bosh-warden-boshlite-ubuntu-trusty-go_agent/3363.9 - latest
2 deployments
Succeeded
</pre>
- <a id="deployment"></a> `bosh -e my-env -d my-dep deployment` (Alias: `dep`)
Shows general deployment information for a given deployment.
Can be used to determine if Director has a deployment with a given name.
<pre class="terminal extra-wide">
$ bosh -e vbox -d cf dep
Using environment '192.168.56.6' as client 'admin'
Name Release(s) Stemcell(s) Team(s) Cloud Config
cf binary-buildpack/1.0.9 bosh-warden-boshlite-ubuntu-trusty-go_agent/3363.9 - latest
capi/1.21.0
cf-mysql/34
cf-smoke-tests/11
uaa/25
dns/3
...
1 deployments
Succeeded
</pre>
- <a id="deploy"></a> `bosh -e my-env -d my-dep deploy manifest.yml [-v ...] [-o ...]`
Create or update specified deployment according to the provided manifest. Operation files and variables can be provided to adjust and fill in manifest before deploy begins.
Currently name provided via `--deployment` (`-d`) flag must match name specified in the manifest.
<pre class="terminal">
$ bosh -e vbox -d cf deploy cf.yml -v system_domain=sys.example.com -o large-footprint.yml
</pre>
- <a id="delete-deployment"></a> `bosh -e my-env -d my-dep delete-deployment [--force]` (Alias: `deld`)
Deletes specified deployment. If `--force` is provided, ignores variety of errors (from IaaS, blobstore, database) when deleting.
Note that if you've deleted your deployment, not all resources may have been freed. For example "deleted" persistent disks will be deleted after a few days to avoid accidental data loss. See [Persistent and Orphaned Disks](persistent-disks.html) for more details.
Succeedes even if deployment is not found.
<pre class="terminal">
$ bosh -e vbox -d cf deld
$ bosh -e vbox -d cf deld --force
</pre>
- <a id="instances"></a> `bosh -e my-env [-d my-dep] instances [--ps] [--details] [--vitals] [--failing]` (Alias: `is`)
Lists all instances managed by the Director or in a single deployment. Show instance names, IPs, and VM and process health.
- `--details` (`-i`) flag includes VM CID, persistent disk CIDs, and other instance level details
- `--ps` flag includes per process health information
- `--vitals` flag shows basic VM and process usage such RAM, CPU and disk.
- `--failing` flag hides all healthy instances and processes leaving only non-healthy ones; useful for scripting
<pre class="terminal">
$ bosh -e vbox is -i
$ bosh -e vbox is --ps --vitals
$ bosh -e vbox -d cf is
$ bosh -e vbox -d cf is --ps
$ bosh -e vbox -d cf is --ps --vitals
</pre>
- <a id="manifest"></a> `bosh -e my-env -d my-dep manifest` (Alias: `man`)
Prints deployment manifest to `stdout`.
<pre class="terminal">
$ bosh -e vbox -d cf man > /tmp/manifest.yml
</pre>
- <a id="recreate"></a> `bosh -e my-env -d my-dep recreate [group[/instance-id]] [--skip-drain] [--fix] [--canaries=] [--max-in-flight=] [--dry-run]`
Recreates VMs for specified instances. Follows typical instance lifecycle.
- `--skip-drain` flag skips running drain scripts
- `--fix` flag replaces unresponsive VMs
- `--canaries=` flag overrides manifest values for `canaries`
- `--max-in-flight=` flag overrides manifest values for `max_in_flight`
- `--dry-run` flag runs through as many operations without altering deployment
<pre class="terminal">
$ bosh -e vbox -d cf recreate
$ bosh -e vbox -d cf recreate --fix
$ bosh -e vbox -d cf recreate diego-cell
$ bosh -e vbox -d cf recreate diego-cell/209c42e5-3c1a-432a-8445-ab8d7c9f69b0
$ bosh -e vbox -d cf recreate diego-cell/209c42e5-3c1a-432a-8445-ab8d7c9f69b0 --skip-drain
$ bosh -e vbox -d cf recreate diego-cell --canaries=0 --max-in-flight=100%
</pre>
- <a id="restart"></a> `bosh -e my-env -d my-dep restart [group[/instance-id]] [--skip-drain] [--canaries=] [--max-in-flight=]`
Restarts jobs (processes) on specified instances. Does not affect VM state.
- `--skip-drain` flag skips running drain scripts
- `--canaries=` flag overrides manifest values for `canaries`
- `--max-in-flight=` flag overrides manifest values for `max_in_flight`
- <a id="start"></a> `bosh -e my-env -d my-dep start [group[/instance-id]] [--canaries=] [--max-in-flight=]`
Starts jobs (processes) on specified instances. Does not affect VM state.
- `--canaries=` flag overrides manifest values for `canaries`
- `--max-in-flight=` flag overrides manifest values for `max_in_flight`
- <a id="stop"></a> `bosh -e my-env -d my-dep stop [group[/instance-id]] [--skip-drain] [--canaries=] [--max-in-flight=]`
Stops jobs (processes) on specified instances. Does not affect VM state unless `--hard` flag is specified.
- `--hard` flag forces VM deletion (keeping persistent disk)
- `--skip-drain` flag skips running drain scripts
- `--canaries=` flag overrides manifest values for `canaries`
- `--max-in-flight=` flag overrides manifest values for `max_in_flight`
- <a id="ignore"></a> `bosh -e my-env -d my-dep ignore group/instance-id`
Ignores instance from being affected by other commands such as `bosh deploy`.
- <a id="unignore"></a> `bosh -e my-env -d my-dep unignore group/instance-id`
Unignores instance from being affected by other commands such as `bosh deploy`.
- <a id="logs"></a> `bosh -e my-env -d my-dep logs [group[/instance-id]] [--follow] ...`
Downloads logs from one or more instances.
- `--dir=` flag specifies destination directory
- `--job=` flag includes only specific jobs logs
- `--only=` flag filters logs (comma-separated)
- `--agent` flag includes only BOSH Agent logs
Additional flags for following logs via SSH:
- `--follow` (`-f`) flag to turn on log following
- `--num` flag shows last number of lines immediately
- `--quiet` (`-q`) flag suppresses printing of headers when multiple files are examined
- `--gw-*` flags allow to configure SSH gateway configuration
See [Location and use of logs](job-logs.html) for details.
<pre class="terminal">
$ bosh -e vbox -d cf logs diego-cell/209c42e5-3c1a-432a-8445-ab8d7c9f69b0
$ bosh -e vbox -d cf logs diego-cell/209c42e5-3c1a-432a-8445-ab8d7c9f69b0 --job=rep --job=silkd
$ bosh -e vbox -d cf logs -f
$ bosh -e vbox -d cf logs -f --num=1000
</pre>
- <a id="events"></a> `bosh -e my-env [-d my-dep] events [--* ...]`
Lists events.
See [Events](events.html) for details.
- `--before-id=` flag shows events with ID less than the given ID
- `--before=` flag shows events before the given timestamp (ex: 2016-05-08 17:26:32)
- `--after=` flag shows events after the given timestamp (ex: 2016-05-08 17:26:32)
- `--task=` flag shows events with the given task ID
- `--instance=` flag shows events with given instance
- `--event-user=` flag shows events with given user
- `--action=` flag shows events with given action
- `--object-type=` flag shows events with given object type
- `--object-id=` flag shows events with given object ID
<pre class="terminal">
$ bosh -e vbox events --instance diego-cell/209c42e5-3c1a-432a-8445-ab8d7c9f69b0
$ bosh -e vbox events --instance diego-cell/209c42e5-3c1a-432a-8445-ab8d7c9f69b0 --task 281
$ bosh -e vbox events -d my-dep
$ bosh -e vbox events --before-id=1298284
$ bosh -e vbox events --before="2016-05-08 17:26:32 UTC" --after="2016-05-07 UTC"
</pre>
- <a id="event"></a> `bosh -e my-env event id`
Shows single event details.
- <a id="variables"></a> `bosh -e my-env -d my-dep variables` (Alias: `vars`)
List variables referenced by the deployment.
---
### <a id="vm-mgmt"></a> VMs
- <a id="vms"></a> `bosh -e my-env [-d my-dep] vms [--vitals]`
Lists all VMs managed by the Director or VMs in a single deployment. Show instance names, IPs and VM CIDs.
`--vitals` flag shows basic VM usage such RAM, CPU and disk.
<pre class="terminal">
$ bosh -e vbox vms
$ bosh -e vbox -d cf vms
$ bosh -e vbox -d cf vms --vitals
</pre>
- <a id="delete-vm"></a> `bosh -e my-env -d my-dep delete-vm cid`
Deletes VM without going through typical instance lifecycle. Clears out VM reference from a Director database if referenced by any instance.
<pre class="terminal">
$ bosh -e vbox -d cf delete-vm i-fs384238fjwjf8
</pre>
---
### <a id="disk-mgmt"></a> Disks
- <a id="disks"></a> `bosh -e my-env -d my-dep disks [--orphaned]`
Lists disks. Currently only supports `--orphaned` flag.
- <a id="attach-disk"></a> `bosh -e my-env -d my-dep attach-disk group/instance-id disk-cid`
Attaches disk to an instance, replacing currently attached disk (if any).
<pre class="terminal">
$ bosh -e vbox -d cf attach-disk postgres/209c42e5-3c1a-432a-8445-ab8d7c9f69b0 vol-shw8f293f2f2
</pre>
- <a id="delete-disk"></a> `bosh -e my-env -d my-dep delete-disk cid`
Deletes orphaned disk.
<pre class="terminal">
$ bosh -e vbox -d cf delete-disk vol-shw8f293f2f2
</pre>
---
### <a id="ssh-mgmt"></a> SSH
- <a id="ssh"></a> `bosh -e my-env -d my-dep ssh [destination] [-r] [-c=cmd] [--opts=opts] [--gw-* ...]`
SSH into one or more instances.
- `--opts` flag allows to pass through options to `ssh`; useful for port forwarding
- `--gw-*` flags allow to configure SSH gateway configuration
<pre class="terminal">
# execute command on all instances in a deployment
$ bosh -e vbox -d cf ssh -c 'uptime'
# execute command on one instance group
$ bosh -e vbox -d cf ssh diego-cell -c 'uptime'
# execute command on a single instance
$ bosh -e vbox -d cf ssh diego-cell/209c42e5-3c1a-432a-8445-ab8d7c9f69b0 -c 'uptime'
# execute command with passwordless sudo
$ bosh -e vbox -d cf ssh diego-cell -c 'sudo lsof -i|grep LISTEN'
# present output in a table by instance
$ bosh -e vbox -d cf ssh -c 'uptime' -r
# port forward UAA port locally
$ bosh -e vbox -d cf ssh uaa/0 --opts ' -L 8080:localhost:8080'
</pre>
- <a id="scp"></a> `bosh -e my-env -d my-dep scp src/dst:[file] src/dst:[file] [-r] [--gw-* ...]`
SCP to/from one or more instances.
- `--recursive` (`-r`) flag allow to copy directory recursively
- `--gw-*` flags allow to configure gateway configuration
<pre class="terminal">
# copy file from this machine to machines a deployment
$ bosh -e vbox -d cf scp ~/Downloads/script.sh :/tmp/script.sh
$ bosh -e vbox -d cf scp ~/Downloads/script.sh diego-cell:/tmp/script.sh
$ bosh -e vbox -d cf scp ~/Downloads/script.sh diego-cell/209c42e5-3c1a-432a-8445-ab8d7c9f69b0:/tmp/script.sh
# copy file from remote machines in a deployment to this machine
$ bosh -e vbox -d cf scp :/tmp/script.sh ~/Downloads/script.sh
$ bosh -e vbox -d cf scp diego-cell:/tmp/script.sh ~/Downloads/script.sh
$ bosh -e vbox -d cf scp diego-cell/209c42e5-3c1a-432a-8445-ab8d7c9f69b0:/tmp/script.sh ~/Downloads/script.sh
# copy files from each instance into instance specific local directory
$ bosh -e vbox -d cf scp diego-cell:/tmp/logs/ /tmp/logs/((instance_id))
</pre>
---
### <a id="errand-mgmt"></a> Errands
- <a id="errands"></a> `bosh -e my-env -d my-dep errands` (Alias: `es`)
Lists all errands defined by the deployment.
<pre class="terminal">
$ bosh -e vbox -d cf es
Using environment '192.168.56.6' as '?'
Using deployment 'cf'
Name
smoke-tests
1 errands
Succeeded
</pre>
- <a id="run-errand"></a> `bosh -e my-env -d my-dep run-errand name [--keep-alive] [--when-changed] [--download-logs] [--logs-dir=dir] [--instance=instance-group/instance-id]`
Runs errand job by name.
- `--keep-alive` flag keeps VM around where errand was executing
- `--when-changed` flag indicates whether to skip running an errand if it previously ran (successfully finished) and errand job configuration did not change
- `--download-logs` flag indicates whether to download full errand logs to a directory specified by `--logs-dir` (defaults to the current directory)
- `--instance=` flag select which instances to use for errand execution (v2.0.31+)
See [Errands](errands.html) for details.
<pre class="terminal">
$ bosh -e vbox -d cf run-errand smoke-tests
$ bosh -e vbox -d cf run-errand smoke-tests --keep-alive
$ bosh -e vbox -d cf run-errand smoke-tests --when-changed
# execute errand on all instances that have colocated status errand
$ bosh -e vbox -d zookeeper run-errand status
# execute errand on one instance
$ bosh -e vbox -d zookeeper run-errand status --instance zookeeper/3e977542-d53e-4630-bc40-72011f853cb5
# execute errand on one instance within an instance group
$ bosh -e vbox -d zookeeper run-errand status --instance zookeeper/first
# execute errand on all instance in an instance group
$ bosh -e vbox -d zookeeper run-errand status --instance zookeeper
# execute errand on two instances
$ bosh -e vbox -d zookeeper run-errand status \
--instance zookeeper/671d5b1d-0310-4735-8f58-182fdad0e8bc \
--instance zookeeper/3e977542-d53e-4630-bc40-72011f853cb5
</pre>
---
### <a id="task-mgmt"></a> Tasks
- <a id="tasks"></a> `bosh -e my-env tasks [--recent[=num]] [--all]` (Alias: `ts`)
Lists active and previously ran tasks.
- `--deployment` (`-d`) flag filters tasks by a deployment
<pre class="terminal">
# currently active tasks
$ bosh -e vbox ts
# currently active tasks for my-dep deployment
$ bosh -e vbox -d my-dep ts
Using environment '192.168.56.6' as '?'
# State Started At Last Activity At User Deployment Description Result
27 done Thu Feb 16 19:16:15 UTC 2017 Thu Feb 16 19:20:33 UTC 2017 admin cockroachdb create deployment /deployments/cockroachdb
26 done Thu Feb 16 18:54:32 UTC 2017 Thu Feb 16 18:55:27 UTC 2017 admin cockroachdb delete deployment cockroachd /deployments/cockroachdb
...
110 tasks
Succeeded
# show last 30 tasks
$ bosh -e vbox ts -r --all
# show last 1000 tasks
$ bosh -e vbox ts -r=1000
</pre>
- <a id="task"></a> `bosh -e my-env task id [--debug] [--result] [--event] [--cpi]` (Alias: `t`)
Shows single task details. Continues to follow task if it did not finish. `Ctrl^C` does not cancel task.
<pre class="terminal">
$ bosh -e vbox t 281
$ bosh -e vbox t 281 --debug
</pre>
- <a id="cancel-task"></a> `bosh -e my-env cancel-task id` (Alias: `ct`)
Cancel task at its next checkpoint. Does not wait until task is cancelled.
<pre class="terminal">
$ bosh -e vbox ct 281
</pre>
---
### <a id="snapshot-mgmt"></a> Snapshots
- <a id="snapshots"></a> `bosh -e my-env -d my-dep snapshots`
Lists disk snapshots for given deployment.
- <a id="take-snapshot"></a> `bosh -e my-env -d my-dep take-snapshot [group/instance-id]`
Takes snapshot for an instance or an entire deployment.
- <a id="delete-snapshot"></a> `bosh -e my-env -d my-dep delete-snapshot cid`
Deletes snapshot.
<pre class="terminal">
$ bosh -e vbox -d cf delete-snapshot snap-shw38ty83f2f2
</pre>
- <a id="delete-snapshots"></a> `bosh -e my-env -d my-dep delete-snapshots`
Deletes snapshots for an entire deployment.
---
### <a id="deployment-recovery"></a> Deployment recovery
- <a id="update-resurrection"></a> `bosh -e my-env update-resurrection on/off`
Enables or disables resurrection globally. This state is not reflected in the `bosh instances` command's `Resurrection` column.
See [Automatic repair with Resurrector](resurrector.html) for details.
- <a id="cloud-check"></a> `bosh -e my-env -d my-dep cloud-check [--report] [--auto]` (Alias: `cck`)
Checks for resource consistency and allows interactive repair.
See [Manual repair with Cloud Check](cck.html) for details.
- <a id="locks"></a> `bosh -e my-env locks`
Lists current locks.
---
### <a id="misc"></a> Misc
- <a id="clean-up"></a> `bosh -e my-env clean-up [--all]`
Cleans up releases, stemcells, orphaned disks, and other unused resources.
- `--all` flag forces cleanup for orphaned disks
- <a id="help"></a> `bosh help`
Shows list of available commands and global options. Consider using `-h` flag for individual commands.
- <a id="interpolate"></a> `bosh interpolate manifest.yml [-v ...] [-o ...] [--vars-store path] [--path op-path]` (Alias: `int`)
Interpolates variables into a manifest sending result to stdout. [Operation files](cli-ops-files.html) and [variables](cli-int.html) can be provided to adjust and fill in manifest before doing a deploy.
`--path` flag can be used to extract portion of a YAML document.
<pre class="terminal">
$ bosh int bosh-deployment/bosh.yml \
--vars-store ./creds.yml \
-o bosh-deployment/virtualbox/cpi.yml \
-o bosh-deployment/virtualbox/outbound-network.yml \
-o bosh-deployment/bosh-lite.yml \
-o bosh-deployment/jumpbox-user.yml \
-v director_name=vbox \
-v internal_ip=192.168.56.6 \
-v internal_gw=192.168.56.1 \
-v internal_cidr=192.168.56.0/24 \
-v network_name=vboxnet0 \
-v outbound_network_name=NatNetwork
$ bosh int creds.yml --path /admin_password
skh32i7rdfji4387hg
$ bosh int creds.yml --path /director_ssl/ca
-----BEGIN CERTIFICATE-----
...
</pre>
Command can be used in a generic way to generate CA and leaf certificates.
```yaml