Minimal AWS SSO setup for personal AWS development
Tags: aws, sso, iam
Published: 2022-03-17 13:48:29

---
title: Minimal AWS SSO setup for personal AWS development
published: true
description: Say goodbye to long-lived credentials and embrace the AWS SSO service!
tags: aws, sso, iam
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a3d3j0z6alvwq2rmr8id.jpeg
---
I would argue that the [AWS SSO](https://aws.amazon.com/single-sign-on/) is a "hidden gem" of AWS service. With AWS SSO, you do not have to deal with [AWS IAM Users](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users.html) and long-lived credentials.

I have a suspicion that there is a lot of misinformation about AWS SSO out there. Some common misconceptions I've heard are:

- _"You need [OKTA](https://www.okta.com/) to use AWS SSO"_.

- _"You have to use [AWS Control Tower](https://aws.amazon.com/controltower/?control-blogs.sort-by=item.additionalFields.createdDate&control-blogs.sort-order=desc) to use AWS SSO"_.

- _"The AWS SSO setup is complex, and only experienced AWS developers can utilize it"_.

None of the above are correct. I'm using AWS SSO for my personal AWS stuff, and I've never had to interact with AWS Control Tower or OKTA in any shape or form. It is entirely possible to have AWS SSO working with a **bare minimum [AWS Organizations](https://aws.amazon.com/organizations/) and AWS IAM configuration**, and this blog post will show you how.

## The why of AWS SSO for AWS development

_"Why should I bother using/taking my time to learn AWS SSO?"_ is a valid question, especially when time is the scarcest resource we have. My arguments in favor of learning/using AWS SSO follow.

The first point is that **you do not have to worry about long-lived credentials** for your AWS accounts anymore (except the root one), which drastically improves the security posture of your environment.

The second point is that **if set up correctly**, AWS SSO is **extremely convenient to use**. In my current personal dev workflow, all I do to obtain a time-bound AWS session is type one short command and pick the right account/IAM role combo.

The third point is that **knowing just a little about AWS SSO** could **help you in your day job** where you **most likely use OKTA (or any other identity provider) with AWS SSO** (If you are not, and the configuration you have works for you, more power to you). Someone had to know how to connect the services in the first place. That someone might be you :).

## Setting the stage

Before we dive into the configuration itself, I think it is vital to set expectations regarding what I'm about to show you.

1. We will only use the bare minimum of AWS services/features for simplicity.

1. I would not recommend using this setup for your company's AWS SSO story. Look into combining [OrgFormation](https://github.com/org-formation/org-formation-cli) / AWS Control Tower with AWS SSO for that.

1. **I've tried to keep the complexity to a minimum** so that people who are not familiar with AWS (for example, me from 3 years ago) can go through the listed steps without significant issues.

1. You will be using the AWS console through configuration steps. Creating an IaC template to automate the setup is beyond this blog post's scope.

## The end goal

After you have completed the configuration steps, you will be able to do the following:

1. Login into a given AWS account console with a single click via the AWS SSO user portal. Here is a screenshot of my AWS SSO portal dashboard.

![AWS SSO portal dashboard sneak-peak](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u2xz7v5p3aru31q9trl4.png)

2. Assume credentials for a given AWS IAM role in a given AWS account for CLI usage with a single command.

Interested? Let us get started with the configuration.

## The configuration

### The prerequisites

- [AWS CLI](https://aws.amazon.com/cli/) installed.

### The steps

**1** - If you do not have an AWS account already, create one. There are many great resources on how to do just that, for example, [this guide by A Cloud Guru](https://acloudguru.com/videos/acg-fundamentals/how-to-create-an-aws-account?utm_campaign=11244863417&utm_source=google&utm_medium=cpc&utm_content=469352928666&utm_term=_&adgroupid=115625160932).

- I would **strongly recommend this AWS account** be **used only for AWS SSO / AWS Organizations set up**. Consider **not** running any deployments on this account.

**2**‏‏‎‏‏‎ - Pick the region you wish your AWS SSO configuration to be deployed into. To my best knowledge, the [AWS SSO is a region-bound service](https://docs.aws.amazon.com/singlesignon/latest/userguide/regions.html#region-data). **For demonstration purposes** I will be using the _eu-west-1_ region throughout this blog post.

![2-AWS-Region](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pwoctne9f5jh7y9o5jzh.png)

**3** - In the search bar, look for AWS SSO service. The _sso_ search phrase should do. Click on the service tile to go to its dashboard.

![3-search-for-sso](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mjwcq49cy7v7mzyp4asu.png)

**4** - After landing on the AWS SSO dashboard, assuming you do not have it enabled in any other AWS regions, you should be presented with a landing page that contains a big _"Enable AWS SSO"_ button – click on it.

![4-landing-page-enable-sso](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rd7fdqgvciuao3eqr7ko.png)

**5** - Assuming you do not have any [AWS Organizations](https://aws.amazon.com/organizations/) created on this account, the AWS console will greet you with the popup to create one. Click on the _"Create AWS Organization"_ button.

![5-create-organization-prompt](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zlf3vk1l2hguzwjgiv8o.png)

- **If you are new to AWS and have no idea what AWS Organizations are**, consider them a way of creating multiple AWS accounts with ease. **You do NOT have to know a lot about them to configure AWS SSO**. Consult the [AWS Organizations documentation](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_introduction.html) for more information.

After waiting a bit for the AWS console to create the AWS Organization, you will be redirected to the AWS SSO service dashboard.

**6** - Next up, we need to create an AWS account we will be SSOing into (and assuming given policy in that account, more on that later). As I eluded earlier, we will be using AWS Organizations to manage AWS accounts. AWS SSO service created an AWS Organization for us in the previous step. Go to the created AWS Organization by searching for the service name.

![6-Search-for-AWS-Organizations](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/atlo5dc1yneyf7apnyd5.png)

**7** - Next up, click on the _"Add an AWS account"_ button.

![7.1-Add an AWS account](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/om9qhk3uhtf2qo7ksjdi.png)

- We want to create a **new AWS account**.

- Pick whatever name you want. My recommendation would be to add the "Development" suffix to the name to signal that this is the account I'm using for playing around – i.e., it contains deployed AWS resources.

- I would leave the _"IAM role name"_ default value. The permission model of AWS Organizations goes beyond the scope of this article.

- I would not bother with any Tags for personal-only use.

![7.2-Create-AWS-Account](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0zheae95pb8izlk1zhlk.png)

**8** - After you have successfully created the AWS account and set the password (the email you have received from AWS), it is time to go back to the AWS SSO dashboard to finish the configuration.

![8-Go-back-to-SSO](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gnt5r6kqdm1bqj2jsnin.png)

**9** - Next, we have to create a [permission set](https://docs.aws.amazon.com/singlesignon/latest/userguide/permissionsetsconcept.html) (a scary name for a collection of IAM Policies) you will be acquiring when SSOing into a given AWS account. **This part is what allows us to ditch the long-lived credentials**. Switch to the _"Permission sets"_ tab and click on _"Create permission set"_.

![9.1-SSO-permission-sets](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/06u7wwpnxogsaqvpdzvi.png)

![9.2-SSO-create-permission-set](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iy8et8k4msvn33mch6oh.png)

**10** - Now comes the permission set creation wizard. The following are my recommendations for each step.

- For the _"Type"_ step, I recommend sticking with _"Use an existing job function policy"_ unless you are adept at writing AWS IAM Policies.

- For the _"Detail"_ step, I recommend picking the _"PowerUserAccess"_ policy. **Make sure you understand what a given policy grants**.

- When it comes to the _"Tags"_ step, I would not bother setting them for personal use, but I leave that decision up to you.

  > Tags are essential in a work environment where multiple teams operate on different resources.

![10-Create-SSO-permission-set](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lm9edogddajjuupkoida.png)

**11** - Next, we have to create a user that can sign in to an AWS SSO user portal. We will be associating the user with a permission set and AWS account later. To create an AWS SSO user, navigate to the _"Users"_ tab and click the _"Add user"_ button.

![11-Add-SSO-User](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r97sl1scuofoi5v1s9f6.png)

- Make sure to save the username you specified in the _"Specify user details"_ step – you will need it later on.

- I would suggest omitting creating groups for simplicity's sake, but that is up to you.

- After you have created the user, **I would strongly consider adding an MFA for that user**.

**12** - With the AWS SSO user created, it is time to tie everything we have been configuring together. Navigate to the _"AWS accounts"_ tab. We will be associating the AWS SSO user with a given permission set and an AWS account.

![12.1-navigate-to-accounts](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rrm7arirt8sse375f31r.png)

![12.2-assign-users-or-groups](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6fexjk8o3pyu6ckmeyls.png)

As with AWS SSO users, the AWS console uses a wizard-style form for this configuration. The following are screenshots that should help you navigate the steps.

![12.3](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q6zp8z6hlmodgwts0tb5.png)

![12.4](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x7pvtl0vembpbaptckpk.png)

![12.5](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/krzhufd5c2hozf7zjca7.png)

## Testing

Okay, we have done everything we need to make the AWS SSO work in its simplest, from – having access to an AWS account without using long-lived credentials. Now it is time to test our setup to ensure everything is working correctly. Let us start with AWS console access using AWS SSO.

### AWS console access through AWS SSO

After finishing step 12 from the _The steps_ section of this article, navigate to the AWS SSO _"Dashboard"_ tab and copy the _"User portal URL"_

![testing-aws-console-access](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i3n4yha2z75hgudy593g.png)

After signing in successfully (**use credentials for AWS SSO user and NOT the AWS account**), you should be able to pick the AWS account and the permission set combo, we have configured in the previous section.

![testing-aws-console-access-2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6lbapxp3x1o0fce0i6vl.png)

The _"Management console"_ link should redirect you to a given AWS account as a _federated user_ scoped to a given permission set.

![testing-aws-console-access-3](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ra74zap8vfdk7s90uesf.png)

**Consider bookmarking the _"User portal URL"_ for easy access**.

### AWS CLI access

With the AWS console access out of the way, let us focus on AWS CLI access and getting the AWS credentials from the AWS SSO session.

Luckily for us, the [AWS CLI](https://aws.amazon.com/cli/) already has excellent support for AWS SSO.

I find the [official AWS CLI SSO configuration guide](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html) to be a very well-put resource on how to configure the AWS CLI with AWS SSO correctly.

After configuring the CLI, I recommend you look into [_aws-export-credentials_](https://github.com/benkehoe/aws-export-credentials) for exporting the credentials as environment variables across different shells you use.

## Possible improvements

One improvement that one can make to the configuration I presented is to encapsulate it within reproducible IaC deployment. This goes beyond my area of expertise as I'm more of an application developer that never had to deal with creating IaC code for AWS Organizations and AWS SSO.

If you feel like this is what you want to do next – great! I would start by reading on either [AWS ControlTower](https://aws.amazon.com/controltower/) or [OrgFormation](https://bahr.dev/2022/02/07/org-formation/).

## Closing words

I hope you find this blog post helpful as I would a couple of months prior when I had no idea what I was doing going through the process I described in the _"The steps"_ section.

We configured AWS SSO for our development account with twelve steps and ditched the long-lived credentials associated with IAM Users in the process.

For more AWS / serverless content, consider following me on Twitter - [@wm_matuszewski](https://twitter.com/wm_matuszewski)

And, as always, thank you for your valuable time.