Skip to content

Commit 75bc902

Browse files
authored
Merge pull request #3 from getcft/release-1.0
Release 1.0
2 parents 8548c3a + 9e4ab2a commit 75bc902

File tree

2 files changed

+52
-31
lines changed

2 files changed

+52
-31
lines changed

README.md

Lines changed: 52 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,59 +3,80 @@
33

44
## Description:
55

6-
This solution creates an [AWS VPC](https://aws.amazon.com/vpc/) environment that has 2 public zones and 2 private zones with an EC2 Target Group that has one EC2 linux instance in it and a [AWS ELB](https://aws.amazon.com/elasticloadbalancing/) (ALB) routing traffic to it.
6+
This <a href="https://aws.amazon.com/cloudformation/" target="_blank">AWS CloudFormation</a> solution deploys an <a href="https://aws.amazon.com/vpc/" target="_blank">AWS VPC</a> environment that has 2 public zones and 2 private zones with an <a href="https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-target-groups.html" target="_blank">EC2 Target Group</a> that has one <a href="https://aws.amazon.com/ec2/" target="_blank">EC2</a> linux instance in it and a <a href="https://aws.amazon.com/elasticloadbalancing/" target="_blank">AWS ELB (ALB)</a> load balancer routing traffic to it.
77

88
The AWS CloudFormation template creates a AWS VPC with 2 public subnets and 2 private subnets with an EC2 Target Group that has one EC2 linux instance running Apache on port 80 in it and a public facing ELB (ALB) routing traffic on port 80 to the EC2 target group.
99

10+
<img src="elb-to-target-group.png" alt="ELB/ALB to EC2 Target Group" />
11+
1012
AWS Virtual Private Cloud (Amazon VPC) lets you provision a logically isolated section of the AWS Cloud where you can launch AWS resources in a virtual network that you define.
1113

1214
AWS Elastic Load Balancing automatically distributes incoming application traffic across multiple targets, such as Amazon EC2 instances, containers, IP addresses, and Lambda functions. It can handle the varying load of your application traffic in a single Availability Zone or across multiple Availability Zones.
1315

14-
AWS Elastic Compute Cloud (Amazon EC2) is a web service that provides secure, resizable compute capacity in the cloud
16+
Each AWS Target Group is used to route requests to one or more registered targets. When you create each listener rule, you specify a target group and conditions. When a rule condition is met, traffic is forwarded to the corresponding target group. You can create different target groups for different types of requests.
17+
18+
AWS Elastic Compute Cloud (Amazon EC2) is a web service that provides secure, resizable compute capacity in the cloud
19+
20+
AWS CloudFormation provides a common language for you to describe and provision all the infrastructure resources in your cloud environment.
21+
1522

16-
_***note AWS ELB and EC2 will incur costs**_
23+
## AWS Resource Costs
1724

18-
* [ELB pricing](https://aws.amazon.com/elasticloadbalancing/pricing/) resource used in example: 1 Application Load Balancer
19-
* [EC2 pricing](https://aws.amazon.com/ec2/pricing/on-demand/) resource used in example: 1 t2.nano
25+
As with most AWS services you will incur costs for usage. For this CloudFormation template the resources that incur costs are as follows.
2026

21-
## Prerequisites:
27+
* Pricing:
2228

23-
* AWS account and environment configured with AWS Credentials
24-
* IAM user with AWSCloudFormationReadOnlyAccess, AmazonVPCFullAccess, AmazonEC2FullAccess
29+
* <a href="https://aws.amazon.com/elasticloadbalancing/pricing/" target="_blank">ELB Pricing</a> resource used in example: *1 Application Load Balancer*
30+
* <a href="https://aws.amazon.com/ec2/pricing/on-demand/" target="_blank">EC2 pricing</a> resource used in example: *1 t2.nano*
31+
32+
## Prerequisites
33+
34+
* <a href="https://aws.amazon.com" target="_blank"> Amazon Web Services Account</a>
35+
* <a href="https://aws.amazon.com/iam/" target="_blank">IAM</a> user with the following permissions:
36+
* AWSCloudFormationReadOnlyAccess
37+
* AmazonVPCFullAccess
38+
* AmazonEC2FullAccess
39+
* An <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html" target="_blank">EC2 Key Pair</a> in the region you are deploying
2540
* This example works without modification in the following regions: us-west-1, us-west-2, us-east-1, us-east-2
2641

27-
## See how it works:
42+
## CloudFormation Template
43+
44+
* The CloudFormation Template is available on GitHub:
45+
* <a href="https://github.com/getcft/aws-elb-to-ec2-target-group-cf-template" target="_blank">aws-elb-to-ec2-target-group-cf-template</a>
46+
47+
## Deploy the CloudFormation Template
2848

29-
AWS Management Console
49+
* AWS Management Console
3050

31-
* Login to AWS Management Console
32-
* Launch in CloudFormation elb-to-ec2-target-group-cf-template.yml (from the repo you cloned)
51+
* Login to *AWS Management Console*
52+
* Launch under *CloudFormation* your *elb-to-ec2-target-group-cf-template.yml* (included in this repo)
3353

34-
CloudFormation Fields
54+
* CloudFormation Fields:
3555

36-
* Stack name (Enter a name to associate to your AWS VPC, ELB, EC2 deployment)
37-
* SSHKeyName (Used for EC2 Instance) **Next**
38-
* Continue choosing **Next**
39-
* Click **Create**
56+
* *Stack name* (Enter a name to associate to your AWS ELB / Target Group deployment)
57+
* SSHKeyName (EC2 Key Pair used for EC2 Instance) *Next*
58+
* Continue choosing *Next* and then *Create* (it may take several mintues to create resources)
4059

41-
## Test:
60+
## Results of the CloudFormation Template
4261

43-
In the AWS Management Console you should be able to verify the following have been created:
62+
In the *AWS Management Console* you should be able to *verify* the following have been created.
4463

45-
* 1 Public Subnet 10.0.10.0/24 (Zone A)
46-
* 1 Private Subnet 10.0.20.0/24 (Zone A)
47-
* 1 Public Subnet 10.0.30.0/24 (Zone B)
48-
* 1 Private Subnet 10.0.40.0/24 (Zone B)
49-
* 5 Route table entries to route either within 10.0.0.0/16 or to the Internet Gateway for outbound
50-
* 1 Internet Gateway
51-
* 1 ELB Security Group with Port 80 open to everyone
52-
* 1 EC2 Security Group with Port 22 open to everyone and Port 80 open to the Load Balancer
53-
* 1 ELB Application Load Balancer
54-
* 1 EC2 t2.nano linux instance running Apache
55-
* 1 EC2 Target Group
64+
* Resources Created:
65+
* 1 Public Subnet 10.0.10.0/24 (in Zone A, with 254 usable IP's)
66+
* 1 Private Subnet 10.0.20.0/24 (in Zone A, with 254 usable IP's)
67+
* 1 Public Subnet 10.0.30.0/24 (in Zone B, with 254 usable IP's)
68+
* 1 Private Subnet 10.0.40.0/24 (in Zone B, with 254 usable IP's)
69+
* 5 Route table entries to route traffic either within 10.0.0.0/16 or to the Internet Gateway for outbound
70+
* 1 Internet Gateway (for all outbound traffic)
71+
* 1 ELB Security Group with Port 80 open to everyone
72+
* 1 EC2 Security Group with Port 22 open to everyone and Port 80 open to the Load Balancer
73+
* 1 ELB Application Load Balancer
74+
* 1 EC2 t2.nano linux instance running Apache
75+
* 1 EC2 Target Group
5676

5777
You can find in the CloudFormation Outputs section the "ALBHostName" copy the hostname from the "Value" column and paste it into a browser you should see the word "Healthy" return.
5878

59-
## Other Things:
79+
## Best Practices
6080

6181
* You would normally put your EC2 instance or instances in a private subnet but to save costs for this example we didn't provision a NAT Gateway but needed to install Apache so we elected to put it in a public subnet.
82+
* For traffic that does not need to be reachable from outside your VPC private network space you can provision ELB to be internal versus this example where ELB is public internet facing.

elb-to-target-group.png

52.3 KB
Loading

0 commit comments

Comments
 (0)