Cloud Object Storage

Cloud Object Storage

Learn | Share | Collaborate

Join our expert network to explore key Cloud Object Storage (COS) use cases, exchange best practices, and stay informed on webinars, feature releases, and Partner offerings.


#Cloud
#Cloud
#Data
 View Only

Unlocking Secure Cross-Account Access with Service ID based authentication using Trusted Profile

By Diksha Mali posted 06/16/26 08:38 AM

  

Imagine you work in a company where different teams manage different IBM Cloud accounts. Your team needs to read files from an Object Storage bucket owned by another team. The simple approach might be: “Just share the credentials.” 

But that quickly becomes risky. Credentials can be leaked, misused, or forgotten during rotation. Now imagine a better approach—instead of sharing keys, you establish trust. Your account proves its identity, and the other account allows access only to specific resources and actions. 

This is exactly what Trusted Profiles in IBM Cloud enables you to do. 

Think of a Trusted Profile as a secure gatekeeper. It allows specific trusted identities—like a Service ID—to temporarily access resources in another account without sharing passwords, API keys, or making users members of that account. For more information on trusted profile, please follow, this link.

In this blog, we’ll walk through how to use Trusted Profiles and Service IDs to securely access IBM Cloud Object Storage (COS) resources across accounts using the IBM COS Go SDK. Support for this feature was added to the IBM COS Go SDK and is available starting from v1.14.0.

The Access Problem


Imagine a large company with separate teams managing their own IBM Cloud accounts. 

  • The Finance Team uses Account A 

  • The Analytics Team uses Account B 

The Analytics Team owns an IBM Cloud Object Storage instance that contains important sales reports inside a bucket called monthly-sales-data. 

Now, a data analyst named Pam from the Finance Team needs access to those reports. 

Here’s the challenge: 

  • Pam belongs only to Account A 

  • The storage bucket belongs to Account B 

  • The Analytics Team does not want to: 

  • Add Pam as a member of their account 

  • Share passwords or API keys 

  • Create permanent credentials that could be misused later 

Traditionally, companies solved this by: 

  • Adding external users into another account 

  • Sharing access keys through email or chat 

  • Creating long-lived service credentials 

But this creates real-world problems: 

  • Security risks → Shared credentials can be leaked or misused 

  • Management overhead → Teams must manually add/remove users 

  • Scalability issues → Difficult to manage when hundreds of users or applications need temporary access across accounts 

So, the organization needs a safer and more scalable approach where: 

  • Pam can securely access only the required bucket 

  • Account B keeps full control of its resources 

  • No credentials are shared 

  • Access can be temporary and tightly restricted 

How We Solve It 

IBM Cloud provides a powerful identity feature called Trusted Profiles that solves this problem. 

A Trusted Profile acts as a trust boundary between identities and resources. 

Instead of granting access directly to users, you: 

  1. Create a Service ID in Account A  

  1. Add that Service ID as a trusted identity in a Trusted Profile 

  1. Configure access policies in Account B for that Trusted Profile 

  1. Use the IBM COS Go SDK to authenticate through the trusted profile 

This establishes a secure trust relationship between: 

  • The Service ID from Account A 

  • The Object Storage resources in Account B 

Once configured: 

  • The Service ID can request temporary IAM tokens 

  • Those tokens grant role-based access to the resources in Account B 

  • No credentials are shared 

  • No additional account membership is required 

 Summary of Proposed solution :

Using this method Pam the data analyst can easily access the data that she requires. 

Implementation Guide 

In this section, we will walk through how to configure secure cross-account access using a Service ID and Trusted Profile. 

To make this easier to understand, let us continue with the same Finance Team example. 

Imagine a company with a centralized cloud setup: 

  • The Analytics Team manages the main IBM Cloud account (Hub Account / Account H) 

  • The Finance Team, Audit Team, and Operations Team each manage their own separate IBM Cloud accounts (Spoke Accounts – S1, S2, S3) 

The Analytics Team owns several IBM Cloud Object Storage (COS) buckets that store different types of business data, such as: 

  • Monthly sales reports – Bucket B1 

  • Audit records – Bucket B2 

  • Operational metrics – Bucket B3 

Summary: 

In order to grant the access to different spokes account using trusted profile we need to have the following setup: 

The setup for S1 involves two IBM Cloud accounts: 

  • Account S1 – Finanace team account that requires the access to monthly reports stored in bucket B1 and owns the service ID 

  • Account H – Analytics team account that owns the bucket B1 

Once the configuration is complete, the Service ID from Account S1 will be able to securely access the COS resources in Account H through a Trusted Profile, without sharing credentials or adding users across accounts. 

Step 1: Create a Service ID in the Source Account (Account S1) 

Manage → Access (IAM) → Service IDs → Create Service ID 

Note: Make sure to note down the IAM ID of the Service ID (iam-ServiceId-xxxxx), as it will be needed later when establishing the trust relationship. 

Step 2: Create an API key in the created service ID 

Created service → API keys → Create 

Securely store the API Key, since it will be used by the Go application to authenticate. 

 

You should now have: 

  • Service ID IAM ID 

  • API Key for the Service ID 

 

Step 3: Create a Trusted Profile in the Hub Account (Account H) 

Now switch to the target account that owns the resource. 

Manage → Access(IAM) → Trusted Profile → Create 

  

After creation, make a note of either: 

  • Trusted Profile ID, or 

  • Trusted Profile Name 

These values will be required when authenticating through the SDK. 

  

Step 4: Adding the service ID to the trusted profile created. 

There are two ways to do this. 

Option 1: Add the Service ID During Profile Creation 

While creating the Trusted Profile, you can directly add the Service ID as a trusted identity. 

Option 2: Add the Service ID to an Existing Trusted Profile 

If the profile already exists: 

Trusted Profile → Service IDs → Add 

Then add the Service ID created in Account A. 

This step ensures that the Service ID is now recognized as a trusted identity by the profile. 

Step 5: Assigning access to the service ID in trusted profile. 

Once the Service ID is trusted by the profile, you must grant the required permissions to the Trusted Profile. 

Trusted Profile → Access → Assign Access Group or Assign Access Policy 

For example, you may grant roles such as: 

  • Reader 

  • Writer 

  • Manager 

In this case we need to add Read access to the bucket B1. 
 
Similar steps can be followed for other spokes accounts S2 and S3. 

At this stage, the cross-account trust setup is complete. 

  

Using the Setup in a Go SDK Application 

Now that the infrastructure is configured, we can use this setup inside a Go application using the IBM COS Go SDK.  

To authenticate, we create a COS client that uses: 

  • The Service ID API Key 

  • The Trusted Profile 

There are two ways to reference a trusted profile: 

  1. Using the Trusted Profile ID 

  1. Using the Trusted Profile Name 

The difference between the two approaches is important. 

1. Using Trusted Profile ID 

The Trusted Profile ID is globally unique across IBM Cloud accounts, so no additional identifiers are required. 

Example: Creating a Client Using Trusted Profile ID  

package main 

import ( 

    "fmt" 

    "os" 
    "github.com/IBM/ibm-cos-sdk-go/aws" 

    "github.com/IBM/ibm-cos-sdk-go/aws/credentials/ibmiam" 

    "github.com/IBM/ibm-cos-sdk-go/aws/session" 

    "github.com/IBM/ibm-cos-sdk-go/service/s3" 

) 

const ( 

    serviceInstanceID  = "crn-of-target-cos-instance" 

    serviceEndpoint   = "cos-endpoint" 

    trustedProfileId   = ""  

    serviceIDApiKey = "api-key-of-service-id" 

) 

func TestTrustedProfile 

func main() { 

    sess := session.Must(session.NewSession()) 

    conf := aws.NewConfig(). 

        WithRegion("us-south"). 

WithEndpoint(serviceEndpoint).      
WithCredentials(ibmiam.NewTrustedProfileCredentialsServiceIDWithTrustedProfileId(aws.NewConfig(), authEndpoint, trustedProfileId, serviceIDApiKey, serviceInstanceID)). 

 WithS3ForcePathStyle(true) 

    client := s3.New(sess, conf) 

    lbInput := s3.ListBucketsInput{} 

    buckets, err := client.ListBuckets(&lbInput) 

    if err != nil { 

           fmt.Println(err) 

        } else { 

        fmt.Println(buckets) 

        fmt.Println("Successfully completes (^ ~ ^)") 

      } 

} 

2.Using Trusted Profile Name 

A Trusted Profile Name is only unique within a specific account. 

Therefore, when using the name, you must also provide the Account ID that owns the Trusted Profile so the system can correctly locate it. 

Example: Creating a Client Using Trusted Profile Name  

package main 

import ( 

    "fmt" 

    "os" 

  

    "github.com/IBM/ibm-cos-sdk-go/aws" 

    "github.com/IBM/ibm-cos-sdk-go/aws/credentials/ibmiam" 

    "github.com/IBM/ibm-cos-sdk-go/aws/session" 

    "github.com/IBM/ibm-cos-sdk-go/service/s3" 

) 

const ( 

    serviceInstanceID  = "crn-of-target-cos-instance"  

    authEndpoint       = "https://iam.cloud.ibm.com/identity/token" 

    serviceEndpoint   = "cos-endpoint" 

    trustedProfileName   = "name-of-trusted-profile" 

    accountId = "account-id-that-owns-trusted-profile" 

    serviceIDApiKey = "api-key-of-service-id" 

) 

func TestTrustedProfile 

func main() { 

    sess := session.Must(session.NewSession()) 

    conf := aws.NewConfig(). 

        WithRegion("us-south"). 

        WithEndpoint(serviceEndpoint).      WithCredentials(ibmiam.NewTrustedProfileCredentialsServiceIDWithTrustedProfileName(aws.NewConfig(), authEndpoint, trustedProfileName, accountId, serviceIDApiKey, serviceInstanceID)). 

        WithS3ForcePathStyle(true) 

    client := s3.New(sess, conf) 

    lbInput := s3.ListBucketsInput{} 

    buckets, err := client.ListBuckets(&lbInput) 

    if err != nil { 

           fmt.Println(err) 

        } else { 

        fmt.Println(buckets) 

        fmt.Println("Successfully completes (^ ~ ^)") 

      } 

} 

Once the client is created, it can be used to perform operations such as: 

  • Listing buckets 

  • Uploading objects (PutObject) 

  • Retrieving objects (GetObject) 

After setting up the client, you can perform S3 operations using the Go code examples provided here.
 
By following these steps the Finance team now has a secure access to the monthly sales report. Using the same steps the access can be provided to the Audit and operations team as well. 

Why Use Trusted Profiles + Service IDs for Cross-Account Access  

Using Trusted Profiles with Service IDs provides several benefits:  

  1. Improved Security 

Credentials do not need to be shared across accounts.  

  1. Credential Management Overhead 

API keys need to be created, rotated, revoked, and audited, which increases operational complexity. 

  1. Easy Revocation 

Access can be revoked instantly by: 

  • Removing the Service ID from the Trusted Profile 

  • Modifying the profile’s access policies 

  1. Fine-Grained Access Control 

Each Service ID can be granted specific roles and permissions. 

  1. Better Scalability 

Trusted Profiles improve scalability by centralizing access control. Instead of configuring permissions separately for every service or account, multiple Service IDs can be attached to the same Trusted Profile and inherit its permissions, making it easier to manage access as systems grow. 

Conclusion 

Cross-account access is a common requirement in modern cloud architectures, especially in organizations that separate workloads across multiple accounts for security and governance reasons. 

By combining Service IDs with Trusted Profiles, IBM Cloud provides a secure and scalable way to enable this access without sharing credentials or expanding account membership. 

This approach enables secure, flexible, and maintainable cross-account authentication, making it an ideal solution for architectures such as hub-and-spoke environments, multi-team deployments, and shared infrastructure platforms. If you are building applications that interact with IBM Cloud Object Storage across multiple accounts, Trusted Profiles provide a clean and secure way to manage that access. 

0 comments
42 views

Permalink