Google Certified Associate Cloud Engineer 2020

Sign Up Free or Log In to participate!

What is the significance of metadata here while copying the log file to the GCS bucket.

What is the significance of metadata here while copying the log file to the GCS bucket.
 
I could have created directly using the below.

# And we copy that file to the bucket specified in the metadata.  
echo "Copying the log file to the bucket..."  
#gsutil cp "${worker_log_file}" "${worker_log_bucket}"  
gsutil cp "${worker_log_file}" gs://gcpchal-logs-bucket/
Ari

Using the metadat option allows you to pass in dynamic data to your script. What if you had 100 VMs each with their own bucket? Would you write 100 seperate scripts?

1 Answers

I think using the metadata in the startup script was simply to demonstrate that useful feature.

Mattias Andersson

Indeed! And I added a few more thoughts about this on Senthil’s other post: https://acloud.guru/forums/gcp-certified-associate-cloud-engineer/discussion/-LqsZNL4vomTqQgC-8PA/-1755-access-token-for-gsutil?answer=-LrL30P_2udKEc2Faec4

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?