How to change the lcoation of firebase storage? - firebase

Hello everyone while checking my costs for my firebase project, I detect that I have high cost caused by appspot . My GCP- is located at eur3 (europe-west). But my firebase Storage is Multi-Regional. So my question is can I change the location for firbebase Storage ? My question is not about us.artficats only about if it's makes sense to change location of firebase storage if so then how ?
Also as you can see that us.artifacts....appspot.com takes HUGE Bandwidth. The Problem should be fixed in Firebase CLI 9.14 but mine is 9.23.1. So I have no idea what caused this problem.Please leave also a solution(if you know a fix )down below.

Cloud Storage for Firebase stores your files in a Google Cloud Storage bucket, making them accessible through both Firebase and Google Cloud. Cloud Storage location is set on a bucket and you can create different buckets in different locations. You can change the storage class of the bucket but changing the location for the bucket is not supported currently. So if you want you can create another bucket with the preferred location. You can follow this guide on how to move and rename the bucket.
Now about the huge bandwidth taken by the us.artifacts....appspot.com bucket, I would suggest you setting up the Life Cycle Management Policy on the bucket as mentioned in this StackOverFlow answer.

Related

How to add my project to multiple GCP resource locations?

I have built a firebase project which has "asia-south1" as its default GCP location, I choose this location because other servers had too much latency. But now I want the application to work in other countries as well, The data of one GCP location will also be accessed by others if we have multiple firebase projects and now I have really no idea how to proceed, your help would be really appreciated.
Hope I was able to clear the question
Thank you
Your Cloud Firestore data can be kept in either a regional or a multi-regional location. The developer must choose a location when Firestore is enabled in a project.
The only way for a developer to alter the location of data in an existing project is to start a new Firestore project at the desired location and transfer the data using the Import/Export capability. A Firestore project's location is not currently possible to be changed.
This is the public documentation on Firestore locations.
Just to clarify and complete my current response a little more, the only way to migrate your data (move your data) to another project at this time is manually using the managed export feature, as stated in this official document, or using cloud functions to schedule exports, as stated in this other one document, and then importing the data into your destination project.
It is unfortunately impossible to change the location of Firestore resource locations after setting up Functions, RTDB or Firestore. As per The Docs, Warning: Setting the location for one of these services (that is, Cloud Firestore, Cloud Storage, or scheduled functions) also sets the location for the others. After you set your project's default GCP resource location, you cannot change it.

Specify non-default bucket to enable Firebase Storage

I have a situation where I'm trying to enable Firebase Storage but also have an App Engine deployment which already created the buckets {project_name}.appspot.com and it give me the following error message:
I'm aware you can change the Firebase bucket after enabling Firebase Storage from the Firebase console, however I don't see a way to do it before/while enabling Firebase Storage.
I'm working with a few restrictions and want to see if I can enable Firebase storage with those. My first restriction is that I cannot create a separate GCP project for this. We have billing credits which are linked to the project. Another is that I cannot change the App Engine configuration, or rather doing so will only be done in the worst case since that's already being used for a production workload. Lastly, our parent organization is pretty strict in terms of their Org policies and is likely not willing to change it.
Is there a way specify a different bucket to enable Firebase Storage to avoid the conflict?
I created a GCP project with an App Engine app and a Firebase project with Firebase Storage enabled. According to the documentation these services require a default resource location in order to be initially provisioned. Firebase Storage makes use of the same default bucket as App Engine to initialize. It appears that your organization might have blocked access to this bucket, which makes Firebase Storage not to work initially. You should request the organizational policies to be temporarily allowed while Firebase Storage is provisioned, and then, as you mentioned, you can change the bucket used by Firebase Storage to a different one. Firebase makes use also of the following Storage service account:
You should make sure that this account has permissions to perform its operation at creation time of the bucket, from the FAQ it also explains this is needed:
Cloud Storage for Firebase creates a default bucket in the App Engine free tier.

Does Firebase Storage support Load Balancing(/GoogleCDN/CloudArmor)? Because of the security rules

Hi short important question:
Like much people I want to use the Load Balancing + Cloud CDN + Cloud Armor stack. Because yeah, CDN and anti DDOS is important. Load Balancing too.
Cloud Storage is supported by Load Balancing of course. But now the question is: Is Firebase Storage supported too (i think yes because it's basically the same, but Firebase Storage has important features like security rules, are they supported too)? Especially: Will the security rules still work? Because Firebase Storage is built on top of Cloud Storage. I have fear that Load Balancing points to the Cloud Storage Bucket instead of the Firebase Storage skin; and therefore the security rules won't work anymore of course.
Thanks in advance!
Second question: When it comes to uploading, is it possible to set up Load Balancing in this process too? I want that e.g Indian users upload their data to an indian bucket instead of an US bucket.

how to know the region location of my firebase storage?

for my firestore database, I can clearly see the location of my database, like in this image
but I can't find out the default location of my firebase storage to store my images. I only find the bucket name
how to find the default region location of my firebase storage ? I need to ensure the location is the nearest from my user
is it always be the same as Default GCP resource location ?
The region of a project's default storage bucket is the same as Firestore. You actually agreed to set it that way in a dialog at some point during project setup. Please read the documentation:
Cloud Firestore and Cloud Storage — If you start using either of these products, you're prompted to select your project's default Google Cloud Platform (GCP) resource location (if it wasn't already selected when setting up another service).

can I set my firebase storage in different region from my Firestore and cloud function?

most of my users will be in Indonesia. I am using Firestore, Cloud Function and Firebase storage in my project. currently I am in development phase and all my data is temporarily stored in us-central 1.
when fetching data from firestore or when I trigger the cloud function, the speed of operation is still acceptable around 1-3s (my data in us-central 1 and I am in Indonesia).
but when fetching image data from Firebase storage, it feels so slow due to high latency. so that is why I want to recreate my project and choose the region as near as possible from Indonesia
but if I see from the table in here: https://cloud.google.com/about/locations#asia-pacific
the nearest cloud storage for firebase from Indonesia is in Singapore, but unfortunately firestore and cloud functions are not available yet in Singapore,
the nearest firestore and cloud function available region from Indonesia are in Hongkong.
so my questions are
how to set my firestore and cloud function in Hongkong but my Firebase Storage is Singapore ?
If I can set in two different regions like that, is there any additional cost for this ?
How to set my Firestore and Cloud Function in Hongkong but my Firebase Storage is Singapore ?
As explained in the documentation:
Before you use Cloud Firestore, you must choose a location for your
database... This location setting is
your project's default Google Cloud Platform (GCP) resource location.
At the time of writing, this Cloud Firestore location is an immutable choices, i.e. it is not changeable (Creating a new project is the only way to change it).
For Cloud Storage, "your default GCP resource location is used for GCP services in your project that require a location setting, specifically, your default Cloud Storage bucket". However, with Cloud Storage, you have the possibility to create new buckets in other locations, if you are under the Blaze pricing plan.
You already got an answer, here, on how to reference to a specific bucket :-)
For Cloud Functions, you should refer to this documentation. You will read that "by default, functions run in the us-central1 region" but that it's quite easy to change the location of a Cloud Function by setting the region parameter in the function definition.
If I can set in two different regions like that, is there any additional cost for this?
Yes, you will have extra cost if your Cloud Function (which is in asia-east2 i.e. Hong Kong) interacts with your Cloud Storage (e.g. creates a file in Storage) which is in asia-southeast1, i.e. Singapore. More details in the documentation, here and here.

Resources