How to use G Suite as an external identity provider for AWS SSO
May 4, 2021: AWS Single Sign-On (SSO) currently does not support G Suite as an identity provider for automatic provisioning of users and groups, or the open source ssosync project, available on Github.
January 11, 2021: This post has been updated to reflect changes to the G Suite user interface.
August 3, 2020: This post has been updated to include some additional information about managing users and permissions.
Do you want to control access to your Amazon Web Services (AWS) accounts with G Suite? In this post, we show you how to set up G Suite as an external identity provider in AWS Single Sign-On (SSO). We also show you how to configure permissions for your users, and how they can access different accounts.
G Suite is used for common business functions like email, calendar, and document sharing. If your organization is using AWS and G Suite, you can use G Suite as an identity provider (IdP) for AWS. You can connect AWS SSO to G Suite, allowing your users to access AWS accounts with their G Suite credentials.
You can grant access by assigning G Suite users to accounts governed by AWS Organizations. The user’s effective permissions in an account are determined by permission sets defined in AWS SSO. They allow you to define and grant permissions based on the user’s job function (such as administrator, data scientist, or developer). These should follow the least privilege principle, granting only permissions that are necessary to perform the job. This way, you can centrally manage user accounts for your employees in the Google Admin console and have fine-grained control over the access permissions of individual users to AWS resources.
In this post, we walk you through the process of setting up G Suite as an external IdP in AWS SSO.
How it works
AWS SSO authenticates your G Suite users by using Security Assertion Markup Language (SAML) 2.0 authentication. SAML is an open standard for secure exchange of authentication and authorization data between IdPs and service providers without exposing users’ credentials. When you use AWS as a service provider and G Suite as an external IdP, the login process is as follows:
- A user with a G Suite account opens the link to the AWS SSO user portal of your AWS Organizations.
- If the user isn’t already authenticated, they will be redirected to the G Suite account login. The user will log in using their G Suite credentials.
- If the login is successful, a response is created and sent to AWS SSO. It contains three different types of SAML assertions: authentication, authorization, and user attributes.
- When AWS SSO receives the response, the user’s access to the AWS SSO user portal is determined. A successful login shows accessible AWS accounts.
- The user selects the account to access and is redirected to the AWS Management Console.
This authentication flow is shown in the following diagram.
The user journey starts at the AWS SSO user portal and ends with the access to the AWS Management Console. Your users experience a unified access to the AWS Cloud, and you don’t have to manage user accounts in AWS Identity and Access Management (IAM) or AWS Directory Service.
User permissions in an AWS account are controlled by permission sets and groups in AWS SSO. A permission set is a collection of administrator-defined policies that determine a user’s effective permissions in an account. They can contain AWS managed policies or custom policies that are stored in AWS SSO, and are ultimately created as IAM roles in a given AWS account. Your users assume these roles when they access a given AWS account and get their effective permissions. This obliges you to fine control the access to the accounts, following the shared-responsibility model established in the cloud.
When you use G Suite to authenticate and manage your users, you have to create a user entity in AWS SSO. The user entity is not a user account, but a logical object. It maps a G Suite user via its primary email address as the username to the user account in AWS SSO. The user entity in AWS SSO allows you to grant a G Suite user access to AWS accounts and define its permissions in those accounts.
AWS SSO initial setup
The AWS SSO service has some prerequisites. You need to first set up AWS Organizations with All features set to enabled, and then sign in with the AWS Organization’s master account credentials. You also need super administrator privileges in G Suite and access to the Google Admin console.
If you’re already using AWS SSO in your account, refer to Considerations for Changing Your Identity Source before making changes.
To set up an external identity provider in AWS SSO
- Open the service page in the AWS Management Console. Then choose Enable AWS SSO.
- After AWS SSO is enabled, you can connect an identity source. On the overview page of the service, select Choose your identity source.
- In the Settings, look for Identity source and choose Change.
- By default, AWS SSO uses its own directory as the identity provider. To use G Suite as your identity provider, you have to switch to an external identity provider. Select External identity provider from the available identity sources.
- Choosing the External identity provider option reveals additional information needed to configure it. Choose Show individual metadata values to show the information you need to configure a custom SAML application.
For the next steps, you need to switch to your Google Admin console and use the service provider metadata information to configure AWS SSO as a custom SAML application.
G Suite SAML application setup
To configure a custom SAML application in G Suite
- In the Google Admin console, navigate to the Web and mobile apps section, select Add App, and then select Add custom SAML app.
- To configure the name of the application, in the App details section, under App name, enter AWS SSO (or another name that clearly identifies this application for your users), and then choose CONTINUE.
- To download the Google IdP metadata, under Option 1: Download IdP metadata, choose DOWNLOAD METADATA, and then choose CONTINUE. This downloads an XML file named GoogleIDPMetadata.xml, which you will use to configure G Suite as the IdP in AWS SSO.
- Using the data from AWS SSO, provide information in the Service provider details, and then choose CONTINUE. The mapping for the data is as follows:
- For ACS URL, enter the AWS SSO ACS URL.
- For Entity ID, enter the AWS SSO Issue URL.
- For Start URL, leave the field blank.
- For Name ID format, choose EMAIL.
- For Name ID, choose Basic Information > Primary email.
- On the Attribute mapping screen, leave the default settings and choose FINISH.
- On the application page, in the User access section, select the down arrow to expand the section.
- In the Service status section, select ON for everyone and choose SAVE. You have now enabled the application for your users. If you want to manage access for particular users you can do this via organizational units (for example, you can enable the AWS SSO application for your engineering department). This doesn’t give access to any resources inside of your AWS accounts. Permissions are granted in AWS SSO.
You’re done configuring AWS SSO in G Suite. Return to the browser tab with the AWS SSO configuration.
AWS SSO configuration
After creating the G Suite application, you can finish SSO setup by uploading Google IdP metadata in the AWS Management Console.
To add identity provider metadata in AWS SSO
- When you configured the custom application in G Suite, you downloaded the GoogleIDPMetadata.xml file. Choose Browse… on the configuration page and select this file from your download folder. Finish this step by choosing Next: Review.
- Type CONFIRM at the bottom of the list of changes and choose Change identity source to complete the setup.
- Next is a message that your change to the configuration is complete. At this point, you can choose Return to settings and proceed to user provisioning.
Manage Users and Permissions
AWS SSO supports automatic user provisioning via the System for Cross-Identity Management (SCIM). However, this is not yet officially supported for G Suite custom SAML applications. AWS and Google are collaborating in the Fast Federation (FastFed) Working Group to enable this. In the meantime, you can either manually create users and groups or use the ssosync project from awslabs to automate the process. Manual provisioning is the easiest option to get started with, but it requires additional identity management processes to ensure that user attributes and group memberships stay up-to-date over time, which is not ideal. The ssosync option eliminates these processes, but is open source code that must be properly evaluated before using in production. First, we’ll walk through the manual option. Details about ssosync and how to use it are further down in the post.
To add a user to AWS SSO
- Select Users from the sidebar of the AWS SSO overview and then choose Add user.
- Enter the user details and use your user’s primary email address (username@gsuite_domain.com) as the username. Choose Next: Groups to add the user to a group.
- We aren’t going to create user groups in this walkthrough. Skip the Add user to groups step by choosing Add user. You will reach the user list page displaying your newly created user and status enabled.
- The next step is to assign the user to a particular AWS account in your AWS Organization. This allows the user to access the assigned account. Select the account you want to assign your user to and choose Assign users.
- Select the user you just added, then choose Next: Permission sets to continue configuring the effective permissions of the user in the assigned account.
- Since you didn’t configure a permission set before, you need to configure one now. Choose Create new permission set.
- AWS SSO has managed permission sets that are similar to the AWS managed policies you already know. Make sure that Use an existing job function policy is selected, then select PowerUserAccess from the list of existing job function policies and choose Create.
- You can now select the created permission set from the list of available sets for the user. Select the PowerUserAccess permission set and choose Finish to assign the user to the account.
- You see a message that the assignment has been successful.
Access an AWS Account with G Suite
You can find your user portal URL in the AWS SSO settings, as shown in the following screenshot. Unauthenticated users who use the link will be redirected to the Google account login page and use their G Suite credentials to log in.
After authenticating, users are redirected to the user portal. They can select from the list of assigned accounts, as shown in the following example, and access the AWS Management Console of these accounts.
You’ve successfully set up G Suite as an external identity provider for AWS SSO. Your users can access your AWS accounts using the credentials they already use.
Another way your users can use AWS SSO is by selecting it from their Google Apps to be redirected to the user portal, as shown in the following screenshot. That is one of the quickest ways for users to access accounts.
Using AWS CLI with SSO
You can use the AWS Command Line Interface (CLI) to access AWS resources. AWS CLI version 2 supports access via AWS SSO. You can automatically or manually configure a profile for the CLI to access resources in your AWS accounts. To authenticate your user, it opens the user portal in your default browser. If you aren’t authenticated, you’re redirected to the G Suite login page. After a successful login, you can select the AWS account you want to access from the terminal.
To upgrade to AWS CLI version 2, follow the instructions in the AWS CLI user guide.
Automatic creation of users and groups
The ssosync project from awslabs can automatically synchronize your users and groups, eliminating the need for manual creation and upkeep. It uses the Directory API in the G Suite Admin SDK to fetch your users and groups and then creates them in AWS SSO. To get started with ssosync, follow the directions provided on the project homepage. The ssosync project is under active development. If you choose to use it, you should regularly check for updates, consider contributing through pull requests, and provide feedback through GitHub.
You’ve set up G Suite as an external IdP for AWS SSO, granted access to an AWS account for a G Suite user, and enforced fine-grained permission controls for this user. This enables your business to have easy access to the AWS Cloud.
If you have feedback about this post, submit comments in the Comments section below.
Want more AWS Security how-to content, news, and feature announcements? Follow us on Twitter.