You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -37,6 +44,98 @@ Below are guidelines for contributing to the devops-security repository hosted o
37
44
<sub>[Back to Table of Contents](#table-of-contents)</sub>
38
45
***
39
46
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>
0 commit comments