- Tag AWS instances.
- Create a specialized AWS IAM role.
- Create an Auth0 rule.
- Test your configuration.
Prerequisites
- You’ll need an Amazon Web Services (AWS) account for which you are an administrator.
- Configure AWS for SSO
- Set up some AWS VM Instances. For the example in this guide, we use three separate instances.
Tag AWS instances
Add tags to your AWS resources. Follow instructions in Amazon Elastic Compute Cloud User Guide for Linux Instances: Adding and Deleting Tags on an Individual Resource. You should have created three instances. Add the following tags:Instance | Tags |
---|---|
1 | Key: CostCenter , Value: marketing .Key: Project , Value: website . |
2 | Key: CostCenter , Value: engineering .Key: Project , Value: management_dashboard . |
3 | Key: CostCenter , Value: marketing .Key: Project , Value: community_site . |
Create a specialized AWS IAM role
Create an IAM role using the AWS SAML you set up during the prerequisites. Follow the instructions in AWS Identity and Access Management User Guide: Creating a Role for SAML 2.0 Federation (Console). While setting up your role, make sure you use the following parameters:Parameter | Description and Sample Value |
---|---|
SAML Provider | Name of the identity provider you created in the prerequisites, such as auth0SamlProvider . Select Allow programmatic and AWS Management Console access. |
VirtualMachineAccessByCostCenter
.
Parameter | Description |
---|---|
Role name | Descriptive name for your role, such as AccessByCostCenter . |
Role description | Description of the purpose for which your role is used. |
Create an Auth0 rule
To map the AWS role and tags to a user, you’ll need to create a rule in Auth0. These values will then be passed through the SAML assertions in the token. For the example:Replace the
awsAccount
variable value with your own account number.Test configuration
You should now be able to log in to the AWS Console using an Auth0 user and test your implementation. To log in, you will need the login for the AWS Console. To find it:- Go to Dashboard > Applications > Applications and select the name of the Application to view.
- On the Addons tab, enable the SAML2 Web App add-on.
- On the Usage tab, locate Identity Provider Login URL.
- Go to the indicated URL.
- Once you have signed in, from EC2, select Instances. Click one of the instances tagged with a
CostCenter
ofmarketing
, and click Actions > Instance State > Stop. Notice that the action completes successfully. - Click the instance tagged with a
CostCenter
ofengineering
, and click Actions > Instance State > Stop. Notice that the action fails with an error.