Building a Robust Web Platform on AWS: A Step-by-Step Journey Through AWS CLI and IAM Identity Center
Tags: aws, development, serverless, devjournal
Published: 2023-11-19 13:30:15

This article continues the story of creating the Page Mosaic Web Platform project.

I have already created an account on the AWS platform. It's not difficult, everything is done quickly. However, before using CDK to create or configure anything on AWS, it's necessary to set up a user with administrative rights and programmatic access to resources.

This means that I don't want to use the root user on my AWS account for manipulating resources. I'm already experienced in this.

Therefore, I enabled IAM Identity Center on my AWS account. As far as I understand, this is a new mechanism for user management, and AWS recommends using it instead of managing IAM users individually.

First, I created a user in IAM Identity Center as described in the instruction at https://docs.aws.amazon.com/singlesignon/latest/userguide/get-started-use-identity-center-directory-create-user-in-identity-center.html.

Then, I added administrative rights to the permission set in my IAM Identity Center, following the instructions at https://docs.aws.amazon.com/singlesignon/latest/userguide/get-started-create-an-administrative-permission-set.html.

And finally, I linked the administrative rights to the user in my account, as outlined at https://docs.aws.amazon.com/singlesignon/latest/userguide/get-started-assign-account-access-admin-user.html.

Now, I needed to check if I could connect to AWS from the command line because I would be running CDK scripts from there.

I installed AWS CLI on my MacBook, following the instructions at https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html.

Next, I needed to configure my user's access. First, I set up the user configuration on my local computer by running the command: 
```
aws configure sso —profile [user name]
```
I used the profile option to separate different user configurations on my computer.

Then I specified the `session name`, which the session token, issued for a certain duration when the user works with resources from the command line, would be linked to.

Next, I authorized on the website in the browser and completed the required forms. The terminal itself opened the browser, and I went through the authorization process.

* Step 1:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ggxpgpuzhaupey3ajnup.png)

* Step 2:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/axew54vi88o08ex0f572.png)

* Step 3:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i5cgr6p4e118ied7wwfz.png)

* Step 4:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/glfkcw42rqdfjazphx5l.png)

* Step 5:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1va5ja80bo98in209q6r.png)

After successful authorization, I returned to the terminal window and specified the region the user would use and the default format.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dpuea0pxpq2ohshzl500.png)

After that, I could already execute commands like: 
```
aws s3 ls --profile sitebud-admin
```

In the next post, I will create the initial structure of the codebase of the platform project and add CDK scripts for deploying and configuring resources for a static website on AWS.