'Cloud build avoid billing by changing eu.artifacts.<project>.appspot.com bucket to single-region

Using app engine standard environment for python 3.7.

When running the app deploy command are container images uploaded to google storage in the bucket eu.artifacts.<project>.appspot.com.

This message is printed during app deploy

 Beginning deployment of service [default]...
#============================================================#
#= Uploading 827 files to Google Cloud Storage              =#
#============================================================#
File upload done.
Updating service [default]...

The files are uploaded to a multi-region (eu), how do I change this to upload to a single region?

Guessing that it's a configuration file that should be added to the repository to instruct app engine, cloud build or cloud storage that the files should be uploaded to a single region.

Is the eu.artifacts.<project>.appspot.com bucket required, or could all files be ignore using the .gcloudignore file?

The issue is similar to this issue How can I specify a region for the Cloud Storage buckets used by Cloud Build for a Cloud Run deployment?, but for app engine.

I'm triggering the cloud build using a service account.

Tried to implement the changes in the solution in the link above, but aren't able to get rid of the multi region bucket.

substitutions:
  _BUCKET: unused
steps:
- name: 'gcr.io/cloud-builders/gcloud'
  args: ['app', 'deploy', '--promote', '--stop-previous-version']
artifacts:
  objects:
    location: 'gs://${_BUCKET}/artifacts'
    paths: ['*']

Command gcloud builds submit --gcs-log-dir="gs://$BUCKET/logs" --gcs-source-staging-dir="gs://$BUCKET/source" --substitutions=_BUCKET="$BUCKET"



Solution 1:[1]

I delete whole bucket after deploying, which prevents billing

gsutil -m rm -r gs://us.artifacts.<project-id>.appspot.com

-m - multi-threading/multi-processing (instead of deleting object-by-object this arguments will delete objects simultaneously)

rm - command to remove objects

-r - recursive

https://cloud.google.com/storage/docs/gsutil/commands/rm

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 buddemat