Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@
"\n",
"BUCKET_ID = \"code-samples-\" + str(uuid.uuid1())\n",
"\n",
"!gsutil mb gs://{BUCKET_ID}"
"!gcloud storage buckets create gs://{BUCKET_ID}"
]
},
{
Expand Down Expand Up @@ -874,7 +874,7 @@
"outputs": [],
"source": [
"# # Delete the Google Cloud Storage bucket and files\n",
"# ! gsutil rm -r gs://{BUCKET_ID}\n",
"# ! gcloud storage rm --recursive gs://{BUCKET_ID}\n",
"# print(f\"Deleted bucket '{BUCKET_ID}'.\")"
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@
},
"outputs": [],
"source": [
"! gsutil mb -l $REGION $BUCKET_URI"
"! gcloud storage buckets create --location=$REGION $BUCKET_URI"
]
},
{
Expand Down Expand Up @@ -584,7 +584,7 @@
"print(IMPORT_FILE)\n",
"\n",
"# printing content of uploaded file\n",
"! gsutil cat $IMPORT_FILE"
"! gcloud storage cat $IMPORT_FILE"
]
},
{
Expand Down Expand Up @@ -707,7 +707,7 @@
"outputs": [],
"source": [
"# create placeholder file for instructions for data labeling\n",
"! echo \"this is instruction\" >> instruction.txt | gsutil cp instruction.txt $BUCKET_URI"
"! echo \"this is instruction\" >> instruction.txt | gcloud storage cp instruction.txt $BUCKET_URI"
]
},
{
Expand Down Expand Up @@ -864,7 +864,7 @@
"\n",
"# Delete the bucket created\n",
"if delete_bucket or os.getenv(\"IS_TESTING\"):\n",
" ! gsutil rm -r $BUCKET_URI"
" ! gcloud storage rm --recursive $BUCKET_URI"
]
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@
},
"outputs": [],
"source": [
"! gsutil mb -l {LOCATION} -p {PROJECT_ID} {BUCKET_URI}"
"! gcloud storage buckets create --location {LOCATION} --project {PROJECT_ID} {BUCKET_URI}"
]
},
{
Expand Down Expand Up @@ -372,13 +372,13 @@
},
"outputs": [],
"source": [
"count = ! gsutil cat $IMPORT_FILE | wc -l\n",
"count = ! gcloud storage cat $IMPORT_FILE | wc -l\n",
"print(\"Number of Examples\", int(count[0]))\n",
"\n",
"print(\"First 10 rows\")\n",
"! gsutil cat $IMPORT_FILE | head\n",
"! gcloud storage cat $IMPORT_FILE | head\n",
"\n",
"heading = ! gsutil cat $IMPORT_FILE | head -n1\n",
"heading = ! gcloud storage cat $IMPORT_FILE | head -n1\n",
"label_column = str(heading).split(\",\")[-1].split(\"'\")[0]\n",
"print(\"Label Column Name\", label_column)\n",
"if label_column is None:\n",
Expand Down Expand Up @@ -840,7 +840,7 @@
"# Delete the Cloud Storage bucket\n",
"delete_bucket = False # set True for deletion\n",
"if delete_bucket:\n",
" ! gsutil rm -r $BUCKET_URI"
" ! gcloud storage rm --recursive $BUCKET_URI"
]
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@
"source": [
"# Create GCS Bucket\n",
"BUCKET_URI = \"gs://your-bucket-name-unique\" # @param {type:\"string\"}\n",
"! gsutil mb -l {LOCATION} -p {PROJECT_ID} {BUCKET_URI}"
"! gcloud storage buckets create --location={LOCATION} --project={PROJECT_ID} {BUCKET_URI}"
]
},
{
Expand Down Expand Up @@ -309,7 +309,7 @@
"IMAGE_URI = \"us-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-12:latest\"\n",
"\n",
"# Copy Test Models to the Bucket\n",
"! gsutil -m cp -r \"gs://cloud-samples-data/vertex-ai/prediction/test-models-requests/tensorflow/*\" {ARTIFACT_URI}\n",
"! gcloud storage cp --recursive \"gs://cloud-samples-data/vertex-ai/prediction/test-models-requests/tensorflow/*\" {ARTIFACT_URI}\n",
"\n",
"model = aiplatform.Model.upload(\n",
" display_name=DISPLAY_NAME,\n",
Expand Down Expand Up @@ -786,7 +786,7 @@
},
"outputs": [],
"source": [
"! gsutil rm -r {BUCKET_URI}"
"! gcloud storage rm --recursive {BUCKET_URI}"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@
},
"outputs": [],
"source": [
"! gsutil mb -l {LOCATION} -p {PROJECT_ID} {BUCKET_URI}"
"! gcloud storage buckets create --location {LOCATION} --project {PROJECT_ID} {BUCKET_URI}"
]
},
{
Expand Down Expand Up @@ -720,9 +720,9 @@
},
"outputs": [],
"source": [
"! gsutil iam ch serviceAccount:{SERVICE_ACCOUNT}:roles/storage.objectCreator $BUCKET_URI\n",
"! gcloud storage buckets add-iam-policy-binding $BUCKET_URI --member=serviceAccount:{SERVICE_ACCOUNT} --role=roles/storage.objectCreator\n",
"\n",
"! gsutil iam ch serviceAccount:{SERVICE_ACCOUNT}:roles/storage.objectViewer $BUCKET_URI"
"! gcloud storage buckets add-iam-policy-binding $BUCKET_URI --member=serviceAccount:{SERVICE_ACCOUNT} --role=roles/storage.objectViewer"
]
},
{
Expand Down Expand Up @@ -840,7 +840,7 @@
"# Delete GCS bucket.\n",
"delete_bucket = False\n",
"if delete_bucket:\n",
" ! gsutil -m rm -r $BUCKET_URI"
" ! gcloud storage rm --recursive $BUCKET_URI"
]
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@
},
"outputs": [],
"source": [
"! gsutil mb -l {LOCATION} -p {PROJECT_ID} {BUCKET_URI}"
"! gcloud storage buckets create --location={LOCATION} --project={PROJECT_ID} {BUCKET_URI}"
]
},
{
Expand Down Expand Up @@ -846,7 +846,7 @@
"# Delete GCS bucket.\n",
"delete_bucket = False # set True for deletion\n",
"if delete_bucket:\n",
" ! gsutil -m rm -r {BUCKET_URI}"
" ! gcloud storage rm --recursive {BUCKET_URI}"
]
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@
},
"outputs": [],
"source": [
"! gsutil mb -l $LOCATION -p $PROJECT_ID $BUCKET_URI"
"! gcloud storage buckets create --location=$LOCATION --project=$PROJECT_ID $BUCKET_URI"
]
},
{
Expand Down Expand Up @@ -840,7 +840,7 @@
"\n",
"delete_bucket = False\n",
"if delete_bucket:\n",
" ! gsutil -m rm -r $BUCKET_URI"
" ! gcloud storage rm --recursive $BUCKET_URI"
]
}
],
Expand Down