Here’s how to display a list the disks attached to an instance.
gcloud compute instances describe instance-name \ --project project-id \ --zone us-central1-c \ --format='yaml(disks[].source)' |
cloud engineer
Here’s how to display a list the disks attached to an instance.
gcloud compute instances describe instance-name \ --project project-id \ --zone us-central1-c \ --format='yaml(disks[].source)' |
gcloud compute instances describe instance-name \ --project project-id \ --zone us-central1-c \ --format='yaml(disks[].source)'
JSON and YAML are used in AWS CloudFormation. Some people prefer YAML for its simplicity. It’s easy to read and code. However, YAML has its own little quirks. It relies heavily on indentation for its structure. If you don’t use the proper spaces, it will fail. I ran into an issue when I ran CloudFormation in AWS. The example below display the contents of my userdata.
This piece of code will NOT work in CloudFormation.
Fn::Base64: !Sub | #!/bin/bash -xe yum update -y mkdir /data cd /data aws s3 cp s3://efs-s3-backup-engine . sleep 30s initiate.sh |
Fn::Base64: !Sub | #!/bin/bash -xe yum update -y mkdir /data cd /data aws s3 cp s3://efs-s3-backup-engine . sleep 30s initiate.sh
This is valid. It’s all about indentation.
Fn::Base64: !Sub | #!/bin/bash -xe yum update -y mkdir /data cd /data aws s3 cp s3://efs-s3-backup-engine . sleep 30s initiate.sh |
Fn::Base64: !Sub | #!/bin/bash -xe yum update -y mkdir /data cd /data aws s3 cp s3://efs-s3-backup-engine . sleep 30s initiate.sh
By the way, tabs are to be avoided like the plague.
JSON, or JavaScript Object Notation, is a minimal, readable format for structuring data. It is used primarily to transmit data between a server and web application, as an alternative to XML. YAML is a flexible, human readable file format that is ideal for storing object trees. YAML stands for “YAML Ain’t Markup Language”. It is easier to read than JSON, and can contain richer meta data. If you would like to switch formats, for example from JSON to YAML or vice versa, there are numerous website out there that can convert your code from one format to another. Check out this json2yaml converter.