1 Answers
Hello Eddie,
I’m not sure what could have gone wrong with your trail, but, follow the below, adjusting it to your own needs:
#: create the new project gcloud projects create pimballeke-new-project005 --enable-cloud-apis #: current documentation does not mention what are the APIs enabled when crating a #: new project with the --enable-cloud-apis flag. I opened a request for better docs: #: https://issuetracker.google.com/issues/155496681 #: enable the billing account for the created project #: list billing accounts gcloud alpha billing accounts list #: link the project and the billing acocunt gcloud alpha billing projects link pimballeke-new-project005 --billing-account XXXXXX-XXXXXX-XXXXXX #: set the current session project's gcloud config set project pimballeke-new-project005 #: set the default region and the default zone on the cloud shell gcloud config set compute/region us-west2 gcloud config set compute/zone us-west2-b #: list enabled apis gcloud services list --enabled NAME TITLE bigquery.googleapis.com BigQuery API bigquerystorage.googleapis.com BigQuery Storage API cloudapis.googleapis.com Google Cloud APIs clouddebugger.googleapis.com Cloud Debugger API cloudtrace.googleapis.com Cloud Trace API compute.googleapis.com Compute Engine API datastore.googleapis.com Cloud Datastore API logging.googleapis.com Cloud Logging API monitoring.googleapis.com Cloud Monitoring API oslogin.googleapis.com Cloud OS Login API servicemanagement.googleapis.com Service Management API serviceusage.googleapis.com Service Usage API sql-component.googleapis.com Cloud SQL stackdriver.googleapis.com Stackdriver API storage-api.googleapis.com Google Cloud Storage JSON API storage-component.googleapis.com Cloud Storage #: enable the compute.googleapis.com as we're going to create a VM gcloud services enable compute.googleapis.com #: list enabled APIs - the below command will delay a little gcloud services list | grep -i compute compute.googleapis.com Compute Engine API #: list configurations gcloud config configurations list #: create the bucket gsutil mb gs://pimballeke-new-project005/ #: create the instance with the user-data script, the metadata for the bucket and the scopes for monitoring, storage and logging gcloud compute instances create myvm01 --metadata lab-logs-bucket=gs://pimballeke-new-project005/ --metadata-from-file startup-script=script.sh --scopes storage-rw,monitoring-write,logging-write --machine-type f1-micro --deletion-protection #: ssh in to check top gcloud compute ssh myvm01 #: check contents on the bucket $ gsutil ls -a gs://pimballeke-new-project005/ gs://pimballeke-new-project005/machine-myvm01-finished.txt#1596746013258924 -- cleaning up #: deleting the vm instance $ gcloud compute instances update myvm01 --no-deletion-protection Setting deletion protection of instance [myvm01] to [False]...done. $ gcloud compute instances delete myvm01 - [myvm01] in [us-west2-b] Do you want to continue (Y/n)? Y Deleted [https://www.googleapis.com/compute/v1/projects/pimballeke-new-project005/zones/us-west2-b/instances/myvm01]. #: deleting the bucket created $ gsutil rm -r gs://pimballeke-new-project005/ Removing gs://pimballeke-new-project005/machine-myvm01-finished.txt#1596746013258924... / [1 objects] The operation completed over 1 objects. Removing gs://pimballeke-new-project005/...
I hope it helps.
Bianchi