As per shown in demo, i tried to do the same. First time when i followed activity, log file was copied to bucket. but later its not working while i am tryinig multiple times from console as well as shell. below steps i used from gcloud shell. please suggest. everything working, but log file is not getting generated and copied to bucket.
Gcloud shell
Project creation —
gcloud projects create mychallenge-nishad-lab
gcloud config set compute/region us-west4
gcloud config set compute/zone us-west4-b
gcloud config set project mychallenge-nishad-lab
link project to billing account —
gcloud alpha billing accounts list
gcloud beta billing projects link mychallenge-nishad-lab –billing-account=011DEB-EA764E-82CE81
Create bucket
gsutil mb gs://challenge-lab1-cmd-nishad
gsutil ls
gsutil du -sh gs://challenge-lab1-cmd-nishad – for size of bucket
gsutil ls -L -b gs://challenge-lab1-cmd-nishad – For informattion of bucket
GCE – Gcloud compute engine API
Enable and list —
gcloud compute instances list — > Y It will enable Gcloud compute engine api
Create vm instances
gcloud compute instances create challengelab1nishad-vm –project=mychallenge-nishad-lab –zone=us-west4-b –machine-type=e2-micro –metadata=lab-logs-bucket=gs://challenge-lab1-cmd-nishad –scopes=https://www.googleapis.com/auth/servicecontrol,https://www.googleapis.com/auth/service.management.readonly,https://www.googleapis.com/auth/logging.write,https://www.googleapis.com/auth/monitoring.write,https://www.googleapis.com/auth/trace.append,https://www.googleapis.com/auth/devstorage.write_only –metadata-from-file=startup-script=/home/nishad_virkud/gcp-cloud-engineer/worker-startup-script.sh