Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 53

Designing Cross-Account Data Sharing with Lake Formation

Recommended resources

Hello! Welcome back to the course.

In our last lesson, we mastered fine-grained security within a single AWS account, learning how to use Data Filters and LF-Tags to implement column-level and cell-level security. This is a vital skill for protecting sensitive information.

Today, we're expanding our view from a single account to an entire data ecosystem. In the real world, data is rarely confined to one AWS account. Different business units, development teams, or even partner organizations operate in separate accounts for billing, security, and administrative isolation. The challenge is to share data securely and efficiently across these boundaries without creating complex, brittle data-copying pipelines.

This lesson directly addresses that challenge. By the end of our 60 minutes, you will be able to design cross-account data sharing patterns using Lake Formation. This is a critical concept for the Data Engineer certification, as it tests your ability to design scalable, secure, and cost-effective data architectures.

We'll cover:

  1. The core mechanics of cross-account sharing, including the roles of AWS Resource Access Manager (RAM) and Resource Links.
  2. The step-by-step process for sharing data from a producer account and consuming it in a consumer account.
  3. The key architectural patterns—Hub-and-Spoke and Data Mesh—and when to apply them.

Why Traditional Cross-Account Sharing Is Hard

Before Lake Formation, sharing data across accounts typically involved creating complex S3 bucket policies and cross-account IAM roles. This approach had several drawbacks:

  • Complexity: IAM policies can become long and difficult to manage, especially with many accounts and tables.
  • Error-Prone: A small mistake in a policy could either block access or grant overly permissive access.
  • Lack of Discoverability: A data analyst in a consumer account had no easy way to know what data was shared with them.
  • No Fine-Grained Control: It was difficult to enforce column or row-level security using just IAM and S3 policies.

Lake Formation was built to solve these problems by providing a centralized, simplified, and secure way to manage data access, both within and across accounts.


The Core Mechanics of Lake Formation Sharing

To understand how Lake Formation works its magic, we need to grasp two key concepts: AWS Resource Access Manager (RAM) and Resource Links.

The following video provides an excellent overview of the business motivations and the technical foundation of the feature.

How AWS Lake Formation Cross Account Feature Works

Let's watch a segment from the 'How AWS Lake Formation Cross Account Feature Works' video by AWS. This will explain the business drivers and the core concepts behind the feature.

Please watch the following three segments: Motivation (02:37 - 06:18): Understand why organizations need cross-account sharing (multiple lines of business, cost attribution). AWS RAM (14:32 - 16:20): Learn how AWS Resource Access Manager (RAM) is the service that orchestrates the sharing behind the scenes. Resource Links (16:20 - 21:01): Pay close attention to this part. It explains the critical concept of Resource Links, which are necessary for consumer accounts to access shared data and resolve naming conflicts.

Let's summarize the key takeaways from the video:

  1. AWS Resource Access Manager (RAM): This is the underlying AWS service that facilitates sharing resources between accounts. When you grant access in Lake Formation to an external account, Lake Formation uses RAM to create a "resource share." The consumer account must then accept this share in the RAM console.

    • Important Note: If both accounts are part of the same AWS Organization, you can configure RAM to automatically accept shares, simplifying the process. For external accounts, manual acceptance is required.
  2. Resource Links: A shared database or table is not directly visible or usable in a consumer account's query engine like Athena. The consumer's Data Lake Administrator must first create a Resource Link. A resource link is essentially a pointer or a symbolic link in the consumer's local Glue Data Catalog that points to the shared resource in the producer's catalog.

    • This solves two problems: it makes the shared resource discoverable in local tools, and it prevents naming collisions if multiple accounts share resources with the same name.

The Cross-Account Sharing Workflow

Now let's walk through the end-to-end process. It involves two parties: the producer account (owner of the data) and the consumer account (recipient of the share).

This process is demonstrated in detail in the video you just watched, but the following article provides a concise, step-by-step summary that is easy to follow.

Cross-Account Data Sharing with AWS Lake Formation ...

This article, 'Cross-Account Data Sharing with AWS Lake Formation', provides a practical, step-by-step guide to the sharing process. We'll use it to structure our understanding of the workflow.

Please review the following steps from the article: Read Step 4: Configure S3 Location for Cross-Account Sharing and Step 5: Configure Glue Catalog Resources for Cross-Account Sharing. Note how permissions are granted to an 'External Account'. Pay special attention to the 'Grantable' option. Read Step 6: Accepting Permissions and Distributing Them Internally in the External Account. This covers the consumer's side: accepting the RAM invitation. Finally, read Step 8: Creating Resource Links for Athena and/or Redshift. This shows the final, crucial step of creating the resource link to make the data queryable.

Summary of the Process:

In the Producer (Source) Account:

  1. Grant Permissions: In Lake Formation, select the database or table to share.
  2. Choose Grant and select External account.
  3. Enter the 12-digit AWS Account ID of the consumer.
  4. Select the permissions to grant (e.g., SELECT, DESCRIBE).
  5. Crucially, decide whether to make the permissions Grantable. If you select Grantable, you allow the Data Lake Admin in the consumer account to further grant those permissions to principals (users and roles) within their own account. This is the standard practice for delegating management.

In the Consumer (Target) Account:

  1. Accept Share: Go to the AWS RAM console and accept the resource share invitation sent from the producer account.
  2. Create Resource Link: In the Lake Formation console, you will now see the shared resource. Select it and choose Create resource link. Give the link a name and choose a local database to store it in.
  3. Grant Local Permissions: The consumer's Data Lake Admin can now grant permissions on the resource link to local IAM users and roles.
  4. Query Data: The local users can now query the resource link in Amazon Athena as if it were a native table in their account. All query costs are incurred by the consumer account.
Test your understanding!

A producer account shares a table named transactions with a consumer account. The Data Lake Admin in the consumer account successfully creates a resource link named shared_transactions inside a local database called finance_db. An analyst in the consumer account has been granted permissions on this resource link.

Which of the following queries would the analyst run in Athena to access the data?
A. SELECT * FROM transactions;
B. SELECT * FROM <producer_account_id>.transactions;
C. SELECT * FROM finance_db.shared_transactions;

Show answer

C. SELECT * FROM finance_db.shared_transactions;

The analyst interacts with the resource link as if it were a local table. The underlying cross-account mechanism is completely transparent to the end-user.


Architectural Design Patterns

Now that we understand the mechanics, let's zoom out to the architectural level. For the exam, you'll need to recommend a sharing pattern based on an organization's requirements for governance and autonomy. There are two primary patterns, plus a hybrid.

This AWS documentation page provides clear definitions of these patterns.

Cross Account FAQS - AWS Lake Formation Best Practices ...

Let's read the 'Cross Account FAQS' from the AWS Lake Formation Best Practices Guide. It clearly defines the three main architectural topologies for cross-account sharing.

Read section 1, which covers 'Peer to Peer (Pure Data Mesh)', 'Hub and Spoke', and 'Centrally governed data mesh'. Focus on understanding the core difference between each model in terms of where data and governance reside.

Here's a breakdown of the patterns:

1. Peer-to-Peer (Data Mesh)

  • Concept: A decentralized model where different business units (data producers) own their data and are responsible for sharing it directly with consumers. There is no central governing body acting as a gatekeeper.
  • Analogy: Think of it as a free market. If you need data from the Marketing department, you request it directly from them.
  • Pros: High autonomy and agility for producers. Reduces bottlenecks.
  • Cons: Can be difficult to enforce consistent governance standards and discover data across the organization.
  • Best for: Organizations with a culture of high trust and autonomy between business units, or where speed and independence are prioritized over centralized control.

2. Hub-and-Spoke

  • Concept: A centralized model. A single "hub" account owns the central data catalog and often the data itself. Other "spoke" accounts act as producers who write data to the hub, and consumers who read data from it. The central governance team in the hub account controls all access.
  • Analogy: A central library. All books (data) are stored in one place, and the head librarian (central team) decides who can check them out.
  • Pros: Strict, centralized governance, security, and auditing. Easy data discovery.
  • Cons: Can become a bottleneck, slowing down access to data. Less autonomy for individual teams.
  • Best for: Organizations in highly regulated industries (like finance or healthcare) that require tight, auditable control over all data assets.
Cross-Account Data Sharing Pattern with AWS Lake Formation
This diagram illustrates a common architecture that resembles a hub-and-spoke or a centrally governed mesh. A central 'Enterprise Data Lake Administration' account manages sharing between producer and consumer accounts, using AWS RAM to facilitate the creation of resource links.

3. Centrally Governed Data Mesh (Hybrid)

  • Concept: This model combines the best of both worlds. Producers still own and manage their data in their own accounts (like a data mesh). However, they "publish" their data's metadata to a central governance account. This central catalog enables discovery and auditing across the organization. Access requests might be routed through the central team, but producers often still grant the final permissions.
  • Analogy: A modern marketplace like Amazon. Individual sellers (producers) own their products, but they list them on a central platform where customers (consumers) can discover them and where the platform enforces certain rules.
  • Pros: Balances producer autonomy with centralized discovery, auditing, and governance. Highly scalable.
  • Cons: More complex to set up than the other two models.
  • Best for: Large, complex enterprises that want the scalability of a data mesh but still need strong central governance and a unified view of their data assets.

For a real-world perspective on why a large enterprise would choose a data mesh architecture, let's hear from JP Morgan Chase.

AWS re:Invent 2021 - Data lakes: Easily build, secure, and share data with AWS Lake Formation

In this clip from an AWS re:Invent session, executives from JP Morgan Chase discuss their journey toward a data mesh architecture using Lake Formation to enable data sharing across their massive organization.

Watch from 41:50 to 46:17. Listen for their reasoning: unlocking business value, democratizing data, moving from a monolithic data lake to a 'logical lake,' and establishing clear data ownership and products.


Conclusion

In this lesson, we have demystified cross-account data sharing in AWS. By leveraging Lake Formation, you can move beyond cumbersome IAM policies and build secure, scalable, and manageable data sharing solutions.

Key Takeaways:

  • Lake Formation uses AWS RAM to orchestrate resource sharing and requires consumers to create Resource Links to access shared data.
  • The Grantable permission is essential for delegating permission management to consumer accounts.
  • You can design sharing architectures using three main patterns:
    • Peer-to-Peer (Data Mesh): For maximum autonomy.
    • Hub-and-Spoke: For maximum central control.
    • Centrally Governed Data Mesh (Hybrid): A scalable balance of both.
  • Choosing the right pattern depends on an organization's culture, governance requirements, and scale.

Next Up:
We have now established a comprehensive governance framework for securing data both within and across accounts. The next logical step is to automate the pipelines that process and transform this data. In our next module, we will dive into Data Pipeline Orchestration, where we'll learn to use services like AWS Step Functions and Amazon EventBridge to build robust, event-driven workflows.