Skip to main content

Google Cloud Batch IAM roles

Seqera accesses your Google Cloud project through the IAM roles granted to the service account in your Google credentials. Grant the roles first, then create the credentials that use the service account.

As an IAM user, you must have access to the service account that submits Batch jobs.

caution

By default, Google Cloud Batch uses the Compute Engine default service account to submit jobs. This service account has the Editor (roles/editor) role. The role includes the permissions Seqera needs, but it is not recommended for production environments. Instead, control job access with a custom service account that has only the permissions Seqera needs to run Batch jobs.

Service account permissions​

A Google Cloud Batch compute environment uses two service accounts, which can be the same account:

  • Credential service account: The service account in your Seqera credentials. Seqera uses it to submit and monitor the Nextflow head job, display logs and reports, list buckets, and create pipeline secrets in Secret Manager.
  • Head job service account: The service account set in Service account email under Advanced options. The Nextflow head job and its tasks run as this account, and Nextflow uses it to submit tasks and to read and write pipeline data in Cloud Storage. If you leave Service account email empty and use Workload Identity Federation, the head job runs as the credential service account. If you leave it empty and use a service account key, the head job runs as the Compute Engine default service account.

Create a custom service account for each, or use one service account and grant it the roles in both of the following lists.

Credential service account​

  • Batch Job Editor (roles/batch.jobsEditor) on the project
  • Logs Viewer (roles/logging.viewer) on the project (to view and retrieve logs from Cloud Logging)
  • Service Account User (roles/iam.serviceAccountUser) on the head job service account
  • Secret Manager Admin (roles/secretmanager.admin) on the project (required if your pipelines use Seqera secrets, because Seqera creates and deletes a Secret Manager secret for each pipeline secret)
  • Storage Bucket Viewer (roles/storage.bucketViewer) on the project (required if you grant storage access per bucket instead of project-wide Storage Admin, which already includes the storage.buckets.list permission)
  • Storage Object Viewer (roles/storage.objectViewer) on the work directory bucket and on any bucket your pipeline publishes reports to (to display task logs, the Nextflow log, and reports)

Seqera needs the storage.buckets.list permission at the project level to list buckets when you create a compute environment, to browse buckets in Data Explorer, and to validate the credential. Bucket-level grants cannot confer storage.buckets.list.

Head job service account​

  • Batch Agent Reporter (roles/batch.agentReporter) on the project
  • Batch Job Editor (roles/batch.jobsEditor) on the project (to submit tasks)
  • Logs Writer (roles/logging.logWriter) on the project (to let jobs generate logs in Cloud Logging)
  • Service Account User (roles/iam.serviceAccountUser) on the head job service account itself (to run tasks as the same account)
  • Secret Manager Secret Accessor (roles/secretmanager.secretAccessor) on the project (required if your pipelines use Seqera secrets, because the head job reads them from Secret Manager)
  • Service Usage Consumer (roles/serviceusage.serviceUsageConsumer) on the project (required only if you set google.enableRequesterPaysBuckets to read requester-pays buckets)
  • The following storage roles on each bucket your pipeline uses:
BucketWithout FusionWith Fusion
Work directoryStorage Object User (roles/storage.objectUser)Storage Object User (roles/storage.objectUser) and Storage Bucket Viewer (roles/storage.bucketViewer)
Input dataStorage Object Viewer (roles/storage.objectViewer)Storage Object Viewer (roles/storage.objectViewer) and Storage Bucket Viewer (roles/storage.bucketViewer)
Publish directory, if different from the work directoryStorage Object User (roles/storage.objectUser)Storage Object User (roles/storage.objectUser)

Fusion reads bucket metadata (storage.buckets.get) for each bucket it accesses. Storage Object User and Storage Object Viewer do not include this permission. Nextflow copies results to the publish directory from the head job, not through Fusion, so the publish directory bucket does not need it. If a bucket is missing storage.buckets.get, Fusion reports the bucket as not found instead of returning a permission error. Storage Bucket Viewer is a Beta role in Google Cloud. To avoid Beta roles, create a custom role with the storage.buckets.get and storage.buckets.list permissions.

Project-wide storage access​

If your Google Cloud project does not require access restrictions on any of its Cloud Storage buckets, you can grant Storage Admin (roles/storage.admin) on the project to both service accounts. This grant replaces the storage roles listed earlier. To grant access only to specific buckets, add each service account as a principal on each bucket individually. See Cloud Storage bucket.

User permissions​

Ask your Google Cloud administrator to grant you the following IAM user permissions to interact with your custom service account:

  • Batch Job Editor (roles/batch.jobsEditor) on the project
  • Service Account User (roles/iam.serviceAccountUser) on the job's service account (default: Compute Engine service account)
  • View Service Accounts (roles/iam.serviceAccountViewer) on the project

Next step​

Create Google Cloud Batch credentials for the credential service account.