Skip to content

Commit 8ebce62

Browse files
authored
Merge pull request #223 from Lemoncode/aws-review
Aws review
2 parents 8336885 + 04964b6 commit 8ebce62

File tree

12 files changed

+123
-41
lines changed

12 files changed

+123
-41
lines changed

04-cloud/aws/02-create-user/readme.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,35 @@ When we sign up to AWS for the first time a new root user is created. This root
66

77
As user with elavated privilages (such as root), log into AWS Console, navigate to _IAM dashboard_ and select _Access management_ option, an inside click on _User groups_
88

9-
[Access user groups](./.resources/user-group/01.png)
9+
![Access user groups](./.resources/user-group/01.png)
1010

1111
Click on `Create group`
1212

13-
[Create user group](./.resources/user-group/02.png)
13+
![Create user group](./.resources/user-group/02.png)
1414

1515
Set up group name `admins`
1616

17-
[Config user group](./.resources/user-group/03.png)
17+
![Config user group](./.resources/user-group/03.png)
1818

1919
Select `AdministratorAccess`
2020

21-
[Add permissions to group](./.resources/user-group/04.png)
21+
![Add permissions to group](./.resources/user-group/04.png)
2222

2323
Scroll down and click on `Create group`
2424

25-
[Confirm group creation](./.resources/user-group/05.png)
25+
![Confirm group creation](./.resources/user-group/05.png)
2626

2727
We have created a new group, notice that there are no users associated, lets change that next.
2828

2929
## Accessing to IAM and Creating a User
3030

3131
From AWS console, search for `IAM` services
3232

33-
[IAM access](./.resources/01-iam.png)
33+
![IAM access](./.resources/01-iam.png)
3434

3535
Now that we're on `Identity and Access Management` service, select users:
3636

37-
[users selection](./.resources/02-users.png)
37+
![users selection](./.resources/02-users.png)
3838

3939
Click on `Create user`
4040

@@ -44,22 +44,22 @@ Let's create a new user:
4444
2. Ensure that we grant access to AWS console.
4545
3. Select `I want to create an IAM user`
4646

47-
[creaete user 1](./.resources/03-create-user-1.png)
47+
![creaete user 1](./.resources/03-create-user-1.png)
4848

4949
As long as we're creating a new user with console access we need to provide a `password`. On real life, you will want that this is a one shot time password, but we're on demo time so check `Custom password` and deselect `User must create a new password at next sign-in`
5050

51-
[creaete user 1](./.resources/04-create-user-2.png)
51+
![creaete user 1](./.resources/04-create-user-2.png)
5252

5353
Click on `Next`
5454

5555
Now we need to set up the permissions for the new user, in our case we're going to select `Add user to group` and check `admins`:
5656

57-
[user group](./.resources/05-user-group.png)
57+
![user group](./.resources/05-user-group.png)
5858

5959
Click on `Next`
6060

6161
Lets have a look and check that everything looks good:
6262

63-
[review](./.resources/06-review.png)
63+
![review](./.resources/06-review.png)
6464

6565
Click on `Create user`. For last a summary page is shown to us, where we can see all our settings.

04-cloud/aws/03-user-key-access/readme.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,28 @@ Now that we've created a new user, we need to generate credentials in order to g
66

77
Access `IAM` and select `Users`
88

9-
[IAM users](./.resources/01-iam-users.png)
9+
![IAM users](./.resources/01-iam-users.png)
1010

1111
Select the previously created user and `click` on it.
1212

13-
[Select user](./.resources/02-select-user.png)
13+
![Select user](./.resources/02-select-user.png)
1414

1515
Now on this menu we can create a new `access key`
1616

17-
[Access key option](./.resources/03-access-key-option.png)
17+
![Access key option](./.resources/03-access-key-option.png)
1818

1919
Click on `Create access key`
2020

2121
Pick use case `Command Line Interface (CLI)`
2222

23-
[Create access key 1](./.resources/04-create-access-key-1.png)
23+
![Create access key 1](./.resources/04-create-access-key-1.png)
2424

25-
[Create access key 2](./.resources/04-create-access-key-2.png)
25+
![Create access key 2](./.resources/05-create-access-key-2.png)
2626

2727
Click on `Next`
2828

2929
Now we can provide a description tag
3030

31-
[Create access key 2](./.resources/04-create-access-key-2.png)
31+
![Create access key 2](./.resources/06-create-access-key-3.png)
3232

3333
Cick on `Create access key`.

04-cloud/aws/05-ec2-deploy/readme.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,12 @@ whoami
8484
Notice that our user is `ec2-user`, this is fine. By the way the user name, will depend on picked AMI. Lets try to install Docker and spin up an Nginx server.
8585

8686
```bash
87-
sudo dnf update
88-
sudo dnf install docker -y
87+
#!/bin/bash
88+
sudo yum update -y
89+
sudo yum install -y docker
8990
sudo systemctl start docker
9091
sudo systemctl enable docker
91-
sudo usermod -aG docker $USER
92-
newgrp docker
92+
sudo usermod -aG docker $USER
9393
```
9494

9595
```bash

04-cloud/aws/06-configuring-security-groups/01-creating-security-group.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22

33
You can find security group configuration under the EC2 service. To get there, select Services, types EC2, then go to the EC2 console. On the left-hand side under Network and Security, you'll see security groups.
44

5-
[01](./.resources/01.png)
5+
![01](./.resources/01.png)
66

77
This will show you the list of your security groups. When you're creating a rule, it will either be `inbound` or `outbound`. Here are some inbound rules that were already created for this security group, and there are also a couple of outbound rules.
88

9-
[02](./.resources/02.png)
9+
![02](./.resources/02.png)
1010

11-
[03](./.resources/03.png)
11+
![03](./.resources/03.png)
1212

1313
To edit a rule, select the `Edit button`.
1414

1515
Let's add a rule to check out type, protocol, and port range. There are several common configurations listed under the Type menu, such as `SSH`, `HTTP`, and `RDP`.
1616

17-
When you select a type, the protocol and port range are automatically populated for you. This is helpful if you don't have all of the port numbers for different protocols memorized. I
17+
When you select a type, the protocol and port range are automatically populated for you. This is helpful if you don't have all of the port numbers for different protocols memorized.
1818

19-
f you need to create a custom rule, for example if you have an application running on port 8080 over TCP, you could select Custom TCP Rule, then put port 8080.
19+
If you need to create a custom rule, for example if you have an application running on port 8080 over TCP, you could select Custom TCP Rule, then put port 8080.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Configuring Security Groups
2+
3+
## Introduction
4+
5+
A **security group is a virtual firewall for your EC2 instance**. It will control both the `inbound` and the `outbound` traffic **to and from your instance**.
6+
7+
- Security groups belong to a VPC
8+
- Assigned at instance level
9+
- Can use same SG in different subnets in same VPC
10+
- Same subnet can have different security groups
11+
12+
> Page 1
13+
14+
### Traffic flow to instance
15+
16+
1. Internet or VPN Gateway
17+
2. Router
18+
3. Route table
19+
4. Network access control list (NACL)
20+
5. Security Group
21+
22+
> Page 2
23+
24+
### Security Group vs. NACL
25+
26+
| Security group | Network Access Control List |
27+
| :--------------------------------------------------------------------: | :------------------------------------------------------------------------: |
28+
| Instance level | Subnet level |
29+
| Allow rules only | Allow and deny rules |
30+
| Evaluate all rules before allowing traffic | Rules processed in numeric order |
31+
| Stateful: return traffic automatically allowed regardless of any rules | Stateless: return traffic must be explicitly allowed by rules |
32+
| Applies to instance only if associate with security group | Automatically applies to all instances in subnets associated with the NACL |
33+
34+
### Security Groups Are Dynamic
35+
36+
- Assign multiple security groups to an instance
37+
- Change the security group(s) assigned to an instance
38+
- Modify secuirty group rules
39+
- Changes to security group are applied immediately
40+
41+
## Security Group Rules
42+
43+
- Type: Pre-defined protocol / port combinations
44+
- Protocol: TCP, UDP, ICMP
45+
- Port Range: Which port are allowed as part of the rule
46+
47+
## Source and Destination
48+
49+
- Security Group
50+
- ID of another security group
51+
- IP Address
52+
- IPv4 or IPv6 CIDR block
53+
- Single address (/32 or /128)

04-cloud/aws/07-ec2-access/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
## Outbound Access on EC2
3838

3939
- Default security group allows all outbound access from EC2
40-
- Access restricted if oubound rule is removed or changed
40+
- Access restricted if outbound rule is removed or changed
4141
- Return response from http server or machine still works
4242
- Security group rules are stateful
4343
- Inbound rule allows port 80 so response is automatically allowed regardless of outbound rules

04-cloud/aws/08-managing-ips/readme.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
## Create and Use a Bastion Server
1414

15+
> Page 1
16+
1517
[Demo: Create and Use a Bastion Server](./demos/01-bastion-server.md)
1618

1719
## Disable Auto-assign Public IP

04-cloud/aws/09-elb/demos/01-setup/readme.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,11 @@ VPC_ID=$(aws ec2 create-vpc --cidr-block 172.31.0.0/16 \
7171
| jq -r '.Vpc."VpcId"')
7272
```
7373

74-
> Enable DNS hostnames from console
74+
> Enable DNS hostnames from console or using AWS CLI as follows:
75+
76+
```bash
77+
aws ec2 modify-vpc-attribute --vpc-id $VPC_ID --enable-dns-hostnames "{\"Value\":true}"
78+
```
7579

7680
### Create web tier subnets
7781

@@ -193,6 +197,8 @@ IMAGE_ID=ami-0302f42a44bf53a45
193197

194198
### Create web instances
195199

200+
> Ensure that `devops_trainer_key` is created in the desired region
201+
196202
```bash
197203
aws ec2 run-instances \
198204
--image-id $IMAGE_ID \
@@ -202,7 +208,7 @@ aws ec2 run-instances \
202208
--security-group-ids $WEBSG \
203209
--associate-public-ip-address \
204210
--private-ip-address 172.31.1.21 \
205-
--tag-specifications ResourceType=instance,Tags='[{Key=name,Value=web1}]'
211+
--tag-specifications ResourceType=instance,Tags='[{Key=Name,Value=web1}]'
206212
```
207213

208214
```bash
@@ -214,7 +220,7 @@ aws ec2 run-instances \
214220
--security-group-ids $WEBSG \
215221
--associate-public-ip-address \
216222
--private-ip-address 172.31.2.22 \
217-
--tag-specifications ResourceType=instance,Tags='[{Key=name,Value=web2}]'
223+
--tag-specifications ResourceType=instance,Tags='[{Key=Name,Value=web2}]'
218224
```
219225

220226
```bash

04-cloud/aws/09-elb/demos/02-user-data/readme.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ Create `install-docker.txt`
66

77
```bash
88
#!/bin/bash
9-
sudo dnf update
10-
sudo dnf install docker -y
9+
sudo yum update -y
10+
sudo yum install -y docker
1111
sudo systemctl start docker
1212
sudo systemctl enable docker
1313
sudo usermod -aG docker $USER
@@ -59,7 +59,7 @@ With this we're finally ready to try to start our instance with user data:
5959
> NOTE: We have taken the image id from region AMI Catalog
6060
6161
```bash
62-
aws ec2 run-instances --image-id ami-07355fe79b493752d \
62+
aws ec2 run-instances --image-id ami-0ef0975ebdd78b77b \
6363
--count 1 --instance-type t3.micro \
6464
--key-name dublin_key --subnet-id $SUBNET --security-group-ids $SSHSG \
6565
--region eu-west-1 \

04-cloud/aws/09-elb/demos/03-web-tier-deploy/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Demo
22

3-
We're going to SSH into web1 and deploy the web front end using `Docker`. We're then going to browse directly to web1's public IP address and verify that the web front end is actually working.
3+
We're going to SSH into web1 and deploy the web front end using `Docker`. We're then going to browse directly to web1's public IP address and verify that the web frontend is actually working.
44

55
- SSH into `web1`
66
- Deploy the front end using Docker

0 commit comments

Comments
 (0)