Access GCP Bucket-Java automation

Jayakrishnan Kunnath
1 min readAug 13, 2021

GCP

As the projects are moving towards cloud, more often during automation we have to deal with accessing cloud platform and perform various actions like

  • Verifying data
  • Download files
  • Check File exists

Here is the implementation steps for accessing GCP cloud storage and let see how to implement it.

Configure GCP in Maven Project

  • Create a maven project
Add Maven dependency for GCP
<!-- https://mvnrepository.com/artifact/com.google.cloud/google-cloud-storage -->
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-storage</artifactId>
<version>1.117.0</version>
</dependency>

Generate Service Account Key : Json

Navigate to GCP cloud URL

  • IAM&Admin → Service Accounts → Generate Json Key
Generate Service account Key

Follow GCP documentation for more detailed steps.

Java Implementation

Here is the code for accessing cloud storage using ‘com.google.cloud.storage’ library using an ‘Singleton design pattern’.

IGCPConnection Interface:

GCPConnection Class

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response

Recommended from Medium

Lists

See more recommendations