Skip to content

Commit b7af2f8

Browse files
committed
docs: provided instructions for login as root setting up MFA, IAM and AWS CLI
1 parent 6fbb9df commit b7af2f8

1 file changed

Lines changed: 99 additions & 0 deletions

File tree

CONTRIBUTING.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ Below are guidelines for contributing to the devops-security repository hosted o
1515
- [**Table of Contents**](#table-of-contents)
1616
- [**Setting up the local development environment**](#setting-up-the-local-development-environment)
1717
- [**Creating a personal AWS account**](#creating-a-personal-aws-account)
18+
- [**Login as root user & setup MFA**](#login-as-root-user-&-setup-mfa)
19+
- [**Setting up IAM and AWS CLI**](#setting-up-iam-and-aws-cli)
20+
- [**Create an IAM User**](#create-an-iam-user)
21+
- [**Create an IAM Group**](#create-an-iam-group)
22+
- [**Attach IAM user to IAM group**](#attach-iam-user-to-iam-group)
23+
- [**Attach `AdministratorAccess` policy to IAM group**](#attach-administratoraccess-policy-to-iam-group)
24+
- [**Generating Access Keys for AWS CLI**](#generating-access-keys-for-aws-cli)
1825
- [**Installing Terraform**](#installing-terraform)
1926
- [**Installing Terraform docs**](#installing-terraform-docs)
2027
- [**Fork the repository**](#fork-the-repository)
@@ -37,6 +44,98 @@ Below are guidelines for contributing to the devops-security repository hosted o
3744
<sub>[Back to Table of Contents](#table-of-contents)</sub>
3845
***
3946

47+
### **Login as root user & setup MFA**
48+
- Open [AWS Management Console](https://console.aws.amazon.com/).
49+
- Choose `Root user` and enter your email.
50+
- Complete security check if prompted.
51+
- Enter password and authenticate with MFA.
52+
- Sign in to access the Console Home page.
53+
- Follow this [guide](https://docs.aws.amazon.com/IAM/latest/UserGuide/enable-virt-mfa-for-root.html) for enabling MFA for the root AWS account.
54+
55+
**Note:** Select the `us-west-2` region. It's not required for managing IAM resources, as they are global. However, it's advisable since our other resources are in the same region.
56+
57+
<sub>[Back to Table of Contents](#table-of-contents)</sub>
58+
***
59+
60+
## **Setting up IAM and AWS CLI**
61+
62+
- Open AWS CloudShell or follow this [link](https://docs.aws.amazon.com/cloudshell/latest/userguide/welcome.html#how-to-get-started)
63+
- ### **Create an IAM User**
64+
65+
Run the following commands
66+
```bash
67+
aws iam create-user --user-name UserName
68+
```
69+
For example if your AWS username was `octocat`:
70+
71+
```bash
72+
aws iam create-user --user-name octocat
73+
```
74+
then create a login profile with username and password with
75+
76+
```bash
77+
aws iam create-login-profile --user-name UserName --password ExamplePassword123!
78+
```
79+
For example if your AWS username was `octocat`:
80+
81+
```bash
82+
aws iam create-login-profile --user-name octocat --password OctocatIsMyPassword234!
83+
```
84+
**Note:** Password length must be 20 characters
85+
86+
<sub>[Back to Table of Contents](#table-of-contents)</sub>
87+
***
88+
- ### **Create an IAM Group**
89+
90+
To create an `AdminGroup` run the command
91+
92+
```bash
93+
aws iam create-group --group-name AdminGroup
94+
```
95+
<sub>[Back to Table of Contents](#table-of-contents)</sub>
96+
***
97+
- ### **Attach IAM user to IAM group**
98+
99+
Next we need to link the newly created IAM user with the IAM group, use the command
100+
101+
```bash
102+
aws iam add-user-to-group --group-name AdminGroup --user-name UserName
103+
```
104+
For example if your AWS username was `octocat`:
105+
106+
```bash
107+
aws iam add-user-to-group --group-name AdminGroup --user-name octocat
108+
```
109+
<sub>[Back to Table of Contents](#table-of-contents)</sub>
110+
***
111+
- ### **Attach `AdministratorAccess` policy to IAM group**
112+
113+
Run the command for attaching `AdministratorAccess` policy to the `AdminGroup`
114+
115+
```bash
116+
aws iam attach-group-policy --policy-arn arn:aws:iam::aws:policy/AdministratorAccess --group-name AdminGroup
117+
```
118+
<sub>[Back to Table of Contents](#table-of-contents)</sub>
119+
***
120+
- Log in as the newly created user instead of continuing to log in as the root user.
121+
- ### **Generating Access Keys for AWS CLI**
122+
- Open CloudShell
123+
- Generate the Access Keys for AWS CLI
124+
```bash
125+
aws iam create-access-key --user-name UserName > access_key.json
126+
```
127+
- Print the contents of `access_key.json` and copy the contents to a secure location (you'll need the keys when you set up AWS CLI below)
128+
```bash
129+
nano access_key.json
130+
```
131+
<sub>[Back to Table of Contents](#table-of-contents)</sub>
132+
***
133+
- [Install AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)
134+
- [Set up the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-quickstart.html)
135+
136+
<sub>[Back to Table of Contents](#table-of-contents)</sub>
137+
***
138+
40139
### **Installing Terraform**
41140
42141
Use the [Official HashiCorp install instructions](https://developer.hashicorp.com/terraform/install) for installing terraform.

0 commit comments

Comments
 (0)