Activating Google Cloud Storage
Prerequisites
You must already have a Google account, such as from Gmail, etc. If you don't have one of these yet, you need to sign up at the main Google account signup site .
Using the default GCS bucket
The default bucket requires no further activation, configuration or permissions, nor are you required to sign up for GCS. The bucket is simply there and ready to use, with a free quota . You do not need to make your app billable if you use this option.
- If your app was created after the App Engine 1.9.0 release, it already has a default GCS bucket: is is automatically created with your app.
- If your app was created before the App Engine 1.9.0 release, you can obtain a a default bucket for it by clicking Create within the Cloud Integration section in the Application Settings page of the App Engine Admin Console.
The default bucket name is typically
<app_id>.appspot.com
,
where you replace
<app_id>
with your app ID. You can find the bucket name in
the App Engine Admin console
Application Settings
page, under the label
Google Cloud Storage Bucket
.
Alternatively, you can use the App Identity
getDefaultGcsBucketName
method to find the name programmatically.
Using a non-default GCS bucket
You can use a Cloud Storage bucket that is not a default GCS bucket. However, using a non-default GCS bucket requires you to sign up for GCS and make your app billable, since you will be charged for this bucket. Note that there is no free quota for non-default GCS buckets and that charges will be incurred per Google Cloud Storage pricing .There are two possible scenarios for using a non default GCS bucket in App Engine:
- You have a new App Engine project created with the Google Developers Console and are creating a new GCS bucket for it in that console.
- You have a legacy app engine app, created using the App Engine console and not with the Google Developers Console .
We'll describe what you need to do for each of the scenarios listed above.
Adding a new GCS bucket to a Google Developers Console project
In this scenario, you add a new GCS bucket to an App Engine app that was created in the Google Developers Console:
- Visit the Google Developers Console and open your project in the console.
- Enable billing for your project by selecting Settings > Enable Billing . Follow the prompts to complete the billing form.
- Wait for the verification email. After it arrives, click on the provided link to verify.
- Return to the console page for your project and click Cloud Storage .
- Click New Bucket and follow the prompts to create a new bucket. Your App Engine App will automatically be given read and write permissions to the bucket. No further configuration or permissions settings are necessary.
Adding a GCS bucket to a legacy App Engine app
In this scenario, you have an App Engine app that was not created in the Google Developers Console, but from the App Engine console.
To add a non-default GCS bucket to this app:
- Click on your app in the the App Engine Admin Console .
- Click on the Application Settings link in the left navigation panel.
-
Locate the
Service Account Number
in the
Basics
section and copy it for
later use. (It will be in the form
<app-id>@appspot.gserviceaccount.com
.) - Locate the Google APIs Console Project Number in the Basics section. There should be a number that is a link. If there is no such heading or if this is blank, locate the Cloud Integration section at the bottom of the screen and click Create to create a project for your legacy app and wait for the project to be created.
- Click the project link under the heading Google APIs Console Project Number to open up your project in the Google Developers Console.
- Enable billing for your project by selecting Settings > Enable Billing . Follow the prompts to complete the billing form.
- Wait for the verification email. After it arrives, click on the provided link to verify.
- Click APIs & auth > API .
- Scroll down to Google Cloud Storage and click its toggle ON to enable GCS for your project.
-
Click
Permissions
>
Add Member
to display the
Add member
form:
-
Add the service account number for your project to the
Email
section:
<app-id>@appspot.gserviceaccount.com
, replacing<app-id>
with your own application ID. -
Select
Can edit
.
-
Add the service account number for your project to the
Email
section:
- Click Add to add the service account. This is used to enable your App Engine app to read and write to the GCS bucket.
- Click Cloud Storage then New Bucket and follow the prompts to create a new bucket. Your App Engine App will be given read and write permissions to the bucket using the service account you added previously.