GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Storage: Can't specify project when creating a bucket · Issue #2643 · googleapis/google-cloud-java

Storage: Can't specify project when creating a bucket #2643

New issue
Copy link
New issue
Copy link
Closed
Closed
Storage: Can't specify project when creating a bucket#2643
Copy link
Assignees
yihanzhen
Labels
api: storageIssues related to the Cloud Storage API.priority: p2Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Description

@BrandonY
BrandonY
opened on Nov 20, 2017
Issue body actions

The client library allows users to create GCS buckets, and it will create them using the project specified when setting up the client. However, there is no way to overrule this and specify a project number at the time of bucket creation.

Activity

  1. andreamlin
    added
    api: storageIssues related to the Cloud Storage API.
    priority: p2Moderately-important priority. Fix may not be included in next release.
    type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.
    on Nov 20, 2017
  2. yihanzhen
    self-assigned this
    on Dec 11, 2017
  3. yihanzhen commented on Dec 11, 2017

    @yihanzhen
    yihanzhen
    on Dec 11, 2017
    Contributor
    More actions

    Hi @BrandonY -
    Thanks for letting us know the issue. Based on my understanding, the best way to create a bucket for a different project is to create a different storage client. Here is a short sample code for your reference:

    Storage storage1 = StorageOptions.newBuilder().setProjectId("project1").getService();
    Storage storage2 = StorageOptions.newBuilder().setProjectId("project2").getService();
    Bucket bucket1 = storage1.create(BucketInfo.of("bucket-1-name"));
    Bucket bucket2 = storage2.create(BucketInfo.of("bucket-2-name"));
    

    The code is repeating but this should be the best practice for now. The reason we are not able to give a public method to specify a projectId when creating a bucket is that the projectId is in deep integration with the client objects (storage1 and storage2 in this case) for all the APIs, and we are not able decouple the two for the moment. If creating a new storage client gives you a lot of problems, please let us know and we will add your request to our long-term plan.

  4. BrandonY commented on Dec 12, 2017

    @BrandonY
    BrandonY
    on Dec 12, 2017
    Author
    More actions

    That makes sense. Still, other products seem to offer this. For example, with the pubsub client, I can do this:

    TopicName name = TopicName.of("[PROJECT]", "[TOPIC]");
    Topic response = topicAdminClient.createTopic(name);
    

    Either way, it shouldn't be a big deal to create a new client when choosing a different project.

  5. yihanzhen
    closed this as completedon Dec 14, 2017
  6. theacodes
    unassigned
    yihanzhen
    on Sep 28, 2018
  7. JustinBeckwith
    assigned
    yihanzhen
    on Feb 1, 2021
  8. chingor13
    added a commit that references this issue on Feb 20, 2026

    deps: update dependency com.google.cloud:google-cloud-bigquery to v2.…

    c65bec0
  9. chingor13
    added 2 commits that reference this issue on Mar 24, 2026

    fix: first attempt should use the min of RPC timeout and total timeout (

    This issue will close once commit 806a52e is merged into the 'main' branch.
    806a52e

    chore: Update generation configuration at Wed Jul 24 02:14:28 UTC 2024 (

    This issue will close once commit c56daec is merged into the 'main' branch.
    c56daec
  10. meltsufin
    added 2 commits that reference this issue on Apr 29, 2026

    deps: update dependency com.google.cloud:google-cloud-storage to v2.6…

    6a4f059

    deps: update dependency com.google.cloud:google-cloud-storage to v2.6…

    2f486b1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @yihanzhen
    yihanzhen

Labels

api: storageIssues related to the Cloud Storage API.priority: p2Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.