Post Syndicated from Harshida Patel original https://aws.amazon.com/blogs/big-data/simplify-access-management-with-amazon-redshift-and-aws-lake-formation-for-users-in-an-external-identity-provider/
Many organizations use identity providers (IdPs) to authenticate users, manage their attributes, and group memberships for secure, efficient, and centralized identity management. You might be modernizing your data architecture using Amazon Redshift to enable access to your data lake and data in your data warehouse, and are looking for a centralized and scalable way to define and manage the data access based on IdP identities. AWS Lake Formation makes it straightforward to centrally govern, secure, and globally share data for analytics and machine learning (ML). Currently, you may have to map user identities and groups to AWS Identity and Access Management (IAM) roles, and data access permissions are defined at the IAM role level within Lake Formation. This setup is not efficient because setting up and maintaining IdP groups with IAM role mapping as new groups are created is time consuming and it makes it difficult to derive what data was accessed from which service at that time.
Amazon Redshift, Amazon QuickSight, and Lake Formation now integrate with the new trusted identity propagation capability in AWS IAM Identity Center to authenticate users seamlessly across services. In this post, we discuss two use cases to configure trusted identity propagation with Amazon Redshift and Lake Formation.
Solution overview
Trusted identity propagation provides a new authentication option for organizations that want to centralize data permissions management and authorize requests based on their IdP identity across service boundaries. With IAM Identity Center, you can configure an existing IdP to manage users and groups and use Lake Formation to define fine-grained access control permissions on catalog resources for these IdP identities. Amazon Redshift supports identity propagation when querying data with Amazon Redshift Spectrum and with Amazon Redshift Data Sharing, and you can use AWS CloudTrail to audit data access by IdP identities to help your organization meet their regulatory and compliance requirements.
With this new capability, users can connect to Amazon Redshift from QuickSight with a single sign-on experience and create direct query datasets. This is enabled by using IAM Identity Center as a shared identity source. With trusted identity propagation, when QuickSight assets like dashboards are shared with other users, the database permissions of each QuickSight user are applied by propagating their end-user identity from QuickSight to Amazon Redshift and enforcing their individual data permissions. Depending on the use case, the author can apply additional row-level and column-level security in QuickSight.
The following diagram illustrates an example of the solution architecture.

In this post, we walk through how to configure trusted identity propagation with Amazon Redshift and Lake Formation. We cover the following use cases:
- Redshift Spectrum with Lake Formation
- Redshift data sharing with Lake Formation
Prerequisites
This walkthrough assumes you have set up a Lake Formation administrator role or a similar role to follow along with the instructions in this post. To learn more about setting up permissions for a data lake administrator, see Create a data lake administrator.
Additionally, you must create the following resources as detailed in Integrate Okta with Amazon Redshift Query Editor V2 using AWS IAM Identity Center for seamless Single Sign-On:
- An Okta account integrated with IAM Identity Center to sync users and groups
- A Redshift managed application with IAM Identity Center
- A Redshift source cluster with IAM Identity Center integration enabled
- A Redshift target cluster with IAM Identity Center integration enabled (you can skip the section to set up Amazon Redshift role-based access)
- Users and groups from IAM Identity Center assigned to the Redshift application
- A permission set assigned to AWS accounts to enable Redshift Query Editor v2 access
- Add the below permission to the IAM role used in Redshift managed application for integration with IAM Identity Center.
Use case 1: Redshift Spectrum with Lake Formation
This use case assumes you have the following prerequisites:
-
- To store the data, you need an Amazon Simple Storage Service (Amazon S3) bucket.
- To run AWS Command Line Interface (AWS CLI) commands, you need to set up AWS CloudShell in your account or the AWS CLI on your workstation. For instructions, refer to Getting started with AWS CloudShell or Set up the AWS CLI, respectively.
- You can use an existing AWS Glue database and table in your account or complete the following steps logged in as an admin to set up these resources.
- Log in to the AWS Management Console as an IAM administrator.
- Go to CloudShell or your AWS CLI and run the following AWS CLI command, providing your bucket name to copy the data:
In this post, we use an AWS Glue crawler to create the external table ny_pub stored in Apache Parquet format in the Amazon S3 location s3://<bucketname>/data/NY-Pub/. In the next step, we create the solution resources using AWS CloudFormation to create a stack named CrawlS3Source-NYTaxiData in us-east-1.
- Download the .yml file or launch the CloudFormation stack.
The stack creates the following resources:
- The crawler
NYTaxiCrawleralong with the new IAM roleAWSGlueServiceRole-RedshiftAutoMount - The AWS Glue database
automountdb

When the stack is complete, continue with the following steps to finish setting up your resources:
- On the AWS Glue console, under Data Catalog in the navigation pane, choose Crawlers.
- Open
NYTaxiCrawlerand choose Edit.
- Under Choose data sources and classifiers, choose Edit.

- For Data source, choose S3.
- For S3 path, enter
s3://<bucketname>/data/NY-Pub/. - Choose Update S3 data source.

- Choose Next and choose Update.
- Choose Run crawler.

After the crawler is complete, you can see a new table called ny_pub in the Data Catalog under the automountdb database.
After you create the resources, complete the steps in the next sections to set up Lake Formation permissions on the AWS Glue table ny_pub for the sales IdP group and access them via Redshift Spectrum.
Enable Lake Formation propagation for the Redshift managed application
Complete the following steps to enable Lake Formation propagation for the Redshift managed application created in Integrate Okta with Amazon Redshift Query Editor V2 using AWS IAM Identity Center for seamless Single Sign-On:
- Log in to the console as admin.
- On the Amazon Redshift console, choose IAM Identity Center connection in the navigation pane.
- Select the managed application that starts with
redshift-iadand choose Edit.

- Select Enable AWS Lake Formation access grants under Trusted identity propagation and save your changes.

Set up Lake Formation as an IAM Identity Center application
Complete the following steps to set up Lake Formation as an IAM Identity Center application:
- On the Lake Formation console, under Administration in the navigation pane, choose IAM Identity Center integration.

- Review the options and choose Submit to enable Lake Formation integration.

The integration status will update to Success.
Alternatively, you can run the following command:
Register the data with Lake Formation
In this section, we register the data with Lake Formation. Complete the following steps:
- On the Lake Formation console, under Administration in the navigation pane, choose Data lake locations.
- Choose Register location.
- For Amazon S3 path, enter the bucket where the table data resides (
s3://<bucketname>/data/NY-Pub/). - For IAM role, choose a Lake Formation user-defined role. For more information, refer to Requirements for roles used to register locations.
- For Permission mode, select Lake Formation.
- Choose Register location.

Next, verify that the IAMAllowedPrincipal group doesn’t have permission on the database.
- On the Lake Formation console, under Data catalog in the navigation pane, choose Databases.
- Select
automountdband on the Actions menu, choose View permissions. - If
IAMAllowedPrincipalis listed, select the principal and choose Revoke.
- Repeat these steps to verify permissions for the table
ny_pub.
Grant the IAM Identity Center group permissions on the AWS Glue database and table
Complete the following steps to grant database permissions to the IAM Identity Center group:
- On the Lake Formation console, under Data catalog in the navigation pane, choose Databases.
- Select the database
automountdband on the Actions menu, choose Grant. - Choose Grant database.
- Under Principals, select IAM Identity Center and choose Add.

- In the pop-up window, if this is the first time assigning users and groups, choose Get started.

- Enter the IAM Identity Center group in the search bar and choose the group.
- Choose Assign.

- Under LF-Tags or catalog resources,
automountdbis already selected for Databases. - Select Describe for Database permissions.
- Choose Grant to apply the permissions.

Alternatively, you can run the following command:
Next, you grant table permissions to the IAM Identity Center group.
- Under Data catalog in the navigation pane, choose Databases.
- Select the database
automountdband on the Actions menu, choose Grant. - Under Principals, select IAM Identity Center and choose Add.
- Enter the IAM Identity Center group in the search bar and choose the group.
- Choose Assign.
- Under LF-Tags or catalog resources,
automountdbis already selected for Databases. - For Tables, choose
ny_pub.
- Select Describe and Select for Table permissions.
- Choose Grant to apply the permissions.

-
-
Alternatively, you can run the following command:
Set up Redshift Spectrum table access for the IAM Identity Center group
Complete the following steps to set up Redshift Spectrum table access:
- Sign in to the Amazon Redshift console using the admin role.
- Navigate to Query Editor v2.
- Choose the options menu (three dots) next to the cluster and choose Create connection.
- Connect as the admin user and run the following commands to make the
ny_pubdata in the S3 data lake available to the sales group:
Validate Redshift Spectrum access as an IAM Identity Center user
Complete the following steps to validate access:
- On the Amazon Redshift console, navigate to Query Editor v2.
- Choose the options menu (three dots) next to the cluster and choose Create connection
- Choose select IAM Identity Center option for Connect option. Provide Okta user name and password in the browser pop-up.
- Once connected as a federated user, run the following SQL commands to query the ny_pub data lake table:

Use Case 2: Redshift data sharing with Lake Formation
This use case assumes you have IAM Identity Center integration with Amazon Redshift set up, with Lake Formation propagation enabled as per the instructions provided in the previous section.
Create a data share with objects and share it with the Data Catalog
Complete the following steps to create a data share:
- Sign in to the Amazon Redshift console using the admin role.
- Navigate to Query Editor v2.
- Choose the options menu (three dots) next to the Redshift source cluster and choose Create connection.
- Connect as admin user using Temporarily credentials using a database user name option and run the following SQL commands to create a data share:
- Authorize the data share by choosing Data shares in the navigation page and selecting the data share
salesdb. - Select the data share and choose Authorize.
Now you can register the data share in Lake Formation as an AWS Glue database.
- Sign in to the Lake Formation console as the data lake administrator IAM user or role.
- Under Data catalog in the navigation pane, choose Data sharing and view the Redshift data share invitations on the Configuration tab.
- Select the datashare salesds and choose Review Invitation.
- Once you review the details choose Accept.
- Provide a name for the AWS Glue database (for example, salesds) and choose Skip to Review and create.
After the AWS Glue database is created on the Redshift data share, you can view it under Shared databases.
Grant the IAM Identity Center user group permission on the AWS Glue database and table
Complete the following steps to grant database permissions to the IAM Identity Center group:
- On the Lake Formation console, under Data catalog in the navigation pane, choose Databases.
- Select the database salesds and on the Actions menu, choose Grant.
- Choose Grant database.
- Under Principals, select IAM Identity Center and choose Add.
- In the pop-up window, enter the IAM Identity Center group awssso in the search bar and choose the awssso-sales group.
- Choose Assign.
- Under LF-Tags or catalog resources, salesds is already selected for Databases.
- Select Describe for Database permissions.
- Choose Grant to apply the permissions.
Next, grant table permissions to the IAM Identity Center group.
- Under Data catalog in the navigation pane, choose Databases.
- Select the database salesds and on the Actions menu, choose Grant.
- Under Principals, select IAM Identity Center and choose Add.
- In the pop-up window, enter the IAM Identity Center group awssso in the search bar and choose the awssso-sales group.
- Choose Assign.
- Under LF-Tags or catalog resources, salesds is already selected for Databases.
- For Tables, choose sales_schema.store_sales.
- Select Describe and Select for Table permissions.
- Choose Grant to apply the permissions.
Mount the external schema in the target Redshift cluster and enable access for the IAM Identity Center user
Complete the following steps:
- Sign in to the Amazon Redshift console using the admin role.
- Navigate to Query Editor v2.
- Connect as an admin user and run the following SQL commands to mount the AWS Glue database customerds as an external schema and enable access to the sales group:
Access Redshift data shares as an IAM Identity Center user
Complete the following steps to access the data shares:
- On the Amazon Redshift console, navigate to Query Editor v2.
- Choose the options menu (three dots) next to the cluster and choose Create connection.
- Connect with IAM Identity Center and the provide IAM Identity Center user and password in the browser login.
- Run the following SQL commands to query the data lake table:
With Transitive Identity Propagation we can now audit user access to dataset from Lake Formation dashboard and service used for accessing the dataset providing complete trackability. For federated user Ethan whose Identity Center User ID is ‘459e10f6-a3d0-47ae-bc8d-a66f8b054014’ you can see the below event log.

Clean up
Complete the following steps to clean up your resources:
- Delete the data from the S3 bucket.
- Delete the Lake Formation application and the Redshift provisioned cluster that you created for testing.
- Sign in to the CloudFormation console as the IAM admin used for creating the CloudFormation stack, and delete the stack you created.
Conclusion
In this post, we covered how to simplify access management for analytics by propagating user identity across Amazon Redshift and Lake Formation using IAM Identity Center. We learned how to get started with trusted identity propagation by connecting to Amazon Redshift and Lake Formation. We also learned how to configure Redshift Spectrum and data sharing to support trusted identity propagation.
Learn more about IAM Identity Center with Amazon Redshift and AWS Lake Formation. Leave your questions and feedback in the comments section.
About the Authors
Harshida Patel is a Analytics Specialist Principal Solutions Architect, with AWS.
Srividya Parthasarathy is a Senior Big Data Architect on the AWS Lake Formation team. She enjoys building data mesh solutions and sharing them with the community.
Maneesh Sharma is a Senior Database Engineer at AWS with more than a decade of experience designing and implementing large-scale data warehouse and analytics solutions. He collaborates with various Amazon Redshift Partners and customers to drive better integration.
Poulomi Dasgupta is a Senior Analytics Solutions Architect with AWS. She is passionate about helping customers build cloud-based analytics solutions to solve their business problems. Outside of work, she likes travelling and spending time with her family.
















Aarthi Srinivasan is a Senior Big Data Architect with AWS Lake Formation. She likes building data lake solutions for AWS customers and partners. When not on the keyboard, she explores the latest science and technology trends and spends time with her family.
Leon Stigter is a Senior Technical Product Manager with AWS Lake Formation. Leon’s focus is on helping developers build data lakes faster, with seamless connectivity to analytical tools, to transform data into game-changing insights. Leon is interested in data and serverless technologies, and enjoys exploring different cities on his mission to taste cheesecake everywhere he goes.






















Raymond Lai is a Senior Solutions Architect who specializes in catering to the needs of large enterprise customers. His expertise lies in assisting customers with migrating intricate enterprise systems and databases to AWS, constructing enterprise data warehousing and data lake platforms. Raymond excels in identifying and designing solutions for AI/ML use cases, and he has a particular focus on AWS Serverless solutions and Event Driven Architecture design.
Bin Wang, PhD, is a Senior Analytic Specialist Solutions Architect at AWS, boasting over 12 years of experience in the ML industry, with a particular focus on advertising. He possesses expertise in natural language processing (NLP), recommender systems, diverse ML algorithms, and ML operations. He is deeply passionate about applying ML/DL and big data techniques to solve real-world problems.
Aditya Shah is a Software Development Engineer at AWS. He is interested in Databases and Data warehouse engines and has worked on performance optimisations, security compliance and ACID compliance for engines like Apache Hive and Apache Spark.
Melody Yang is a Senior Big Data Solution Architect for Amazon EMR at AWS. She is an experienced analytics leader working with AWS customers to provide best practice guidance and technical advice in order to assist their success in data transformation. Her areas of interests are open-source frameworks and automation, data engineering and DataOps.











Sandeep Adwankar is a Senior Technical Product Manager at AWS. Based in the California Bay Area, he works with customers around the globe to translate business and technical requirements into products that enable customers to improve how they manage, secure, and access data.
Navnit Shukla serves as an AWS Specialist Solution Architect with a focus on Analytics. He possesses a strong enthusiasm for assisting clients in discovering valuable insights from their data. Through his expertise, he constructs innovative solutions that empower businesses to arrive at informed, data-driven choices. Notably, Navnit Shukla is the accomplished author of the book titled Data Wrangling on AWS. He can be reached via 


















Ramkumar Nottath is a Principal Solutions Architect at AWS focusing on Analytics services. He enjoys working with various customers to help them build scalable, reliable big data and analytics solutions. His interests extend to various technologies such as analytics, data warehousing, streaming, data governance, and machine learning. He loves spending time with his family and friends.
Mert Hocanin is a Principal Big Data Architect at AWS within the AWS Lake Formation Product team. He has been with Amazon for over 10 years, and enjoys helping customers build their data lakes with a focus on governance on a wide variety of services. When he isn’t helping customers build data lakes, he spends his time with his family and traveling.


















Ashley Zhou is a Software Development Engineer at AWS. She is interested in data analytics and distributed systems.
Srividya Parthasarathy is a Senior Big Data Architect on the AWS Lake Formation team. She enjoys building analytics and data mesh solutions on AWS and sharing them with the community.

































Shoukat Ghouse is a Senior Big Data Specialist Solutions Architect at AWS. He helps customers around the world build robust, efficient and scalable data platforms on AWS leveraging AWS analytics services like AWS Glue, AWS Lake Formation, Amazon Athena and Amazon EMR.
Rana Dutt is a Principal Solutions Architect at Amazon Web Services. He has a background in architecting scalable software platforms for financial services, healthcare, and telecom companies, and is passionate about helping customers build on AWS.
Ranjith Rayaprolu is a Senior Solutions Architect at AWS working with customers in the Pacific Northwest. He helps customers design and operate Well-Architected solutions in AWS that address their business problems and accelerate the adoption of AWS services. He focuses on AWS security and networking technologies to develop solutions in the cloud across different industry verticals. Ranjith lives in the Seattle area and loves outdoor activities.
Justin Leto is a Sr. Solutions Architect at Amazon Web Services with specialization in databases, big data analytics, and machine learning. His passion is helping customers achieve better cloud adoption. In his spare time, he enjoys offshore sailing and playing jazz piano. He lives in New York City with his wife and baby daughter.







































Aarthi Srinivasan is a Senior Big Data Architect with AWS Lake Formation. She likes building data lake solutions for AWS customers and partners. When not on the keyboard, she explores the latest science and technology trends and spends time with her family.


















Aarthi Srinivasan is a Senior Big Data Architect with AWS Lake Formation. She likes building data lake solutions for AWS customers and partners. When not on the keyboard, she explores the latest science and technology trends and spends time with her family.



Yadukishore Tatavarthi is a Senior Partner Solutions Architect supporting Healthcare and life science customers at Amazon Web Services. He has been helping the customers over the last 20 years in building the enterprise data strategies, advising customers on cloud implementations, migrations, reference architecture creation, data modeling best practices, data lake/warehouses architecture, and other technical processes.
Sudhir Gupta is a Principal Partner Solutions Architect, Analytics Specialist at AWS with over 18 years of experience in Databases and Analytics. He helps AWS partners and customers design, implement, and migrate large-scale data & analytics (D&A) workloads. As a trusted advisor to partners, he enables partners globally on AWS D&A services, builds solutions/accelerators, and leads go-to-market initiatives
Deepak Singh is a Senior Solutions Architect at Amazon Web Services with 20+ years of experience in Data & AIA. He enjoys working with AWS partners and customers on building scalable analytical solutions for their business outcomes. When not at work, he loves spending time with family or exploring new technologies in analytics and AI space.




















Praveen Kumar is an Analytics Solution Architect at AWS with expertise in designing, building, and implementing modern data and analytics platforms using cloud-native services. His areas of interests are serverless technology, modern cloud data warehouses, streaming, and ML applications.
Srividya Parthasarathy is a Senior Big Data Architect on the AWS Lake Formation team. She enjoys building data mesh solutions and sharing them with the community.
Paul Villena is an Analytics Solutions Architect in AWS with expertise in building modern data and analytics solutions to drive business value. He works with customers to help them harness the power of the cloud. His areas of interests are infrastructure as code, serverless technologies, and coding in Python.
Mostafa Safipour is a Solutions Architect at AWS based out of Sydney. He works with customers to realize business outcomes using technology and AWS. Over the past decade, he has helped many large organizations in the ANZ region build their data, digital, and enterprise workloads on AWS.














































Nitin Arora is a Sr. Software Development Manager for Finance Automation in Amazon. He has over 18 years of experience building business critical, scalable, high-performance software. Nitin leads several data and analytics initiatives within Finance, which includes building Data Mesh. In his spare time, he enjoys listening to music and read.
Pradeep Misra is a Specialist Solutions Architect at AWS. He works across Amazon to architect and design modern distributed analytics and AI/ML platform solutions. He is passionate about solving customer challenges using data, analytics, and AI/ML. Outside of work, Pradeep likes exploring new places, trying new cuisines, and playing board games with his family. He also likes doing science experiments with his daughters.
Rajesh Rao is a Sr. Technical Program Manager in Amazon Finance. He works with Data Services teams within Amazon to build and deliver data processing and data analytics solutions for Financial Operations teams. He is passionate about delivering innovative and optimal solutions using AWS to enable data-driven business outcomes for his customers.
Andrew Long, the lead developer for data mesh, has designed and built many of the big data processing systems that have fueled Amazon’s financial data processing infrastructure. His work encompasses a range of areas, including S3-based table formats for Spark, diverse Spark performance optimizations, distributed orchestration engines and the development of data cataloging systems. Additionally, Andrew finds pleasure in sharing his knowledge of partner acrobatics.
Kumar Satyen Gaurav, is an experienced Software Development Manager at Amazon, with over 16 years of expertise in big data analytics and software development. He leads a team of engineers to build products and services using AWS big data technologies, for providing key business insights for Amazon Finance Operations across diverse business verticals. Beyond work, he finds joy in reading, traveling and learning strategic challenges of chess.



























Nishchai JM is an Analytics Specialist Solutions Architect at Amazon Web services. He specializes in building Big-data applications and help customer to modernize their applications on Cloud. He thinks Data is new oil and spends most of his time in deriving insights out of the Data.
Varad Ram is Senior Solutions Architect in Amazon Web Services. He likes to help customers adopt to cloud technologies and is particularly interested in artificial intelligence. He believes deep learning will power future technology growth. In his spare time, he like to be outdoor with his daughter and son.
Narendra Gupta is a Specialist Solutions Architect at AWS, helping customers on their cloud journey with a focus on AWS analytics services. Outside of work, Narendra enjoys learning new technologies, watching movies, and visiting new places
Arun A K is a Big Data Solutions Architect with AWS. He works with customers to provide architectural guidance for running analytics solutions on the cloud. In his free time, Arun loves to enjoy quality time with his family






Jonatan Selsing is former research scientist with a PhD in astrophysics that has turned to the cloud. He is currently the Lead Cloud Engineer at Novo Nordisk, where he enables data and analytics workloads at scale. With an emphasis on reducing the total cost of ownership of cloud-based workloads, while giving full benefit of the advantages of cloud, he designs, builds, and maintains solutions that enable research for future medicines.
Hassen Riahi is a Sr. Data Architect at AWS Professional Services. He holds a PhD in Mathematics & Computer Science on large-scale data management. He works with AWS customers on building data-driven solutions.
Alessandro Fior is a Sr. Data Architect at AWS Professional Services. He is passionate about designing and building modern and scalable data platforms that accelerate companies to extract value from their data.


































Vikram Sahadevan is a Senior Resident Architect on the AWS Data Lab team. He enjoys efforts that focus around providing prescriptive architectural guidance, sharing best practices, and removing technical roadblocks with joint engineering engagements between customers and AWS technical resources that accelerate data, analytics, artificial intelligence, and machine learning initiatives.
Suvendu Kumar Patra possesses 18 years of experience in infrastructure, database design, and data engineering, and he currently holds the position of Senior Resident Architect at Amazon Web Services. He is a member of the specialized focus group, AWS Data Lab, and his primary duties entail working with executive leadership teams of strategic AWS customers to develop their roadmaps for data, analytics, and AI/ML. Suvendu collaborates closely with customers to implement data engineering, data hub, data lake, data governance, and EDW solutions, as well as enterprise data strategy and data management.