DEV Community

Nirosha Jaganathan
Nirosha Jaganathan

Posted on

Create 3-Tier Architecture using AWS

Introduction:

Part 0:
S3 Bucket Creation
IAM EC2 Instance Role Creation
Download Code from Github Repository

Download Code from Github
git clone https://github.com/aws-samples/aws-three-tier-web-architecture-workshop.git
S3 Bucket Creation
S3->create S3Bucket
Image description

Image description

Image description

IAM EC2 Instance Role Creation
Navigate to the IAM dashboard in the AWS console and create an EC2 role.

Image description

Select EC2 as the trusted entity.

Image description

When adding permissions, include the following AWS managed policies. You can search for them and select them. These policies will allow our instances to download our code from S3 and use Systems Manager Session Manager to securely connect to our instances without SSH keys through the AWS console.
AmazonSSMManagedInstanceCore
AmazonS3ReadOnlyAccess

Image description

Give your role a name, and then click Create Role.

Image description

part 1: Networking and Security

Learning Objectives:
Create an isolated network with the following components:
VPC
Subnets
Route Tables
Internet Gateway
NAT gateway
Security Groups

Create VPC and Subnets

Image description
Image description

Subnet Creation

Image description
Create 6 subnets
Public-Subnet-AZ-1, Private-Subnetdb-AZ-1, Private-subnet-AZ-1.
Public-Subnet-AZ-2, Private-Subnetdb-AZ-2, Private-subnet-AZ-2.

Image description
Image description
Image description
Image description

Image description

Your final subnet setup should be similar to this. Verify that you have 3 subnets across 2 different availability zones.

Image description
Internet Connectivity

Internet Gateway
In order to give the public subnets in our VPC internet access we will have to create and attach an Internet Gateway. On the left hand side of the VPC dashboard, select Internet Gateway.

Image description

Create Internet gateway

Image description

Attach to VPC

Image description

Image description

Create NAT Gateway

NAT-GW-AZ-1

Image description

NAT-GW-AZ-2

Image description

Create Public Route Table

Image description

Edit the Routes

Image description

Image description

Edit Subnet Associations

Image description

Add Public Subnets

Image description

Create private Route Table for az1

Image description

Edit Routes

Image description

Edit Subnet Associations

Image description

Create private route table for Az2

Image description

Edit Routes

Image description

Edit Subnet Associations

Image description

Create Security Group

Internet Facing lb sg

Image description

Web Tier SG

Image description

Internal lb SG

Image description

Private Instance SG

Image description

Database SG

Image description

PART-3
Database Deployment

Create DB Subnet Groups

Image description

Image description

Database Deployment
Create Database

Image description
Image description
Image description
Image description
Image description
Image description

Image description
View Connections details & Store the details.

Image description

Deleting DB

Image description
Image description
Image description
Image description
Image description
Delete NAT Gateway

Image description

Image description

Release Elastic IPs

Image description
Image description

Delete Internet Gateway

Image description
Image description
Image description

Delete Snapshots

Image description

Top comments (0)