-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c884d96
commit 9750955
Showing
7 changed files
with
627 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
aws cloudformation create-stack \ | ||
--stack-name $1 \ | ||
--template-body file://$2 \ | ||
--parameters file://$3 \ | ||
--region=us-west-2 | ||
read -p "Press any key..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
[ | ||
{ | ||
"ParameterKey": "EnvironmentName", | ||
"ParameterValue": "NDProject2" | ||
}, | ||
{ | ||
"ParameterKey": "VpcCidr", | ||
"ParameterValue": "10.0.0.0/16" | ||
}, | ||
{ | ||
"ParameterKey": "SubnetBitmask", | ||
"ParameterValue": "24" | ||
}, | ||
{ | ||
"ParameterKey": "PrivateSubnet1Ip", | ||
"ParameterValue": "10.0.20.0" | ||
}, | ||
{ | ||
"ParameterKey": "PrivateSubnet2Ip", | ||
"ParameterValue": "10.0.21.0" | ||
}, | ||
{ | ||
"ParameterKey": "PublicSubnet1Ip", | ||
"ParameterValue": "10.0.10.0" | ||
}, | ||
{ | ||
"ParameterKey": "PublicSubnet2Ip", | ||
"ParameterValue": "10.0.11.0" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,250 @@ | ||
Description: > | ||
Florian Born / Udacity Cloud DevOps ND | ||
Project 2 | ||
Parameters: | ||
EnvironmentName: | ||
Type: String | ||
VpcCidr: | ||
Type: String | ||
SubnetBitmask: | ||
Type: String | ||
PublicSubnet1Ip: | ||
Type: String | ||
PublicSubnet2Ip: | ||
Type: String | ||
PrivateSubnet1Ip: | ||
Type: String | ||
PrivateSubnet2Ip: | ||
Type: String | ||
|
||
Resources: | ||
Vpc: | ||
Type: AWS::EC2::VPC | ||
Properties: | ||
CidrBlock: !Ref VpcCidr | ||
Tags: | ||
- Key: Name | ||
Value: !Ref EnvironmentName | ||
|
||
# Subnets | ||
|
||
PublicSubnet1: | ||
Type: AWS::EC2::Subnet | ||
Properties: | ||
AvailabilityZone: | ||
!Select | ||
- 0 | ||
- !GetAZs | ||
CidrBlock: | ||
Fn::Join: ["/", [!Ref PublicSubnet1Ip, !Ref SubnetBitmask]] | ||
Tags: | ||
- Key: Name | ||
Value: !Ref EnvironmentName | ||
VpcId: !Ref Vpc | ||
|
||
PublicSubnet2: | ||
Type: AWS::EC2::Subnet | ||
Properties: | ||
AvailabilityZone: | ||
!Select | ||
- 1 | ||
- !GetAZs | ||
CidrBlock: | ||
Fn::Join: ["/", [!Ref PublicSubnet2Ip, !Ref SubnetBitmask]] | ||
Tags: | ||
- Key: Name | ||
Value: !Ref EnvironmentName | ||
VpcId: !Ref Vpc | ||
|
||
PrivateSubnet1: | ||
Type: AWS::EC2::Subnet | ||
Properties: | ||
AvailabilityZone: | ||
!Select | ||
- 0 | ||
- !GetAZs | ||
CidrBlock: | ||
Fn::Join: ["/", [!Ref PrivateSubnet1Ip, !Ref SubnetBitmask]] | ||
Tags: | ||
- Key: Name | ||
Value: !Ref EnvironmentName | ||
VpcId: !Ref Vpc | ||
|
||
PrivateSubnet2: | ||
Type: AWS::EC2::Subnet | ||
Properties: | ||
AvailabilityZone: | ||
!Select | ||
- 1 | ||
- !GetAZs | ||
CidrBlock: | ||
Fn::Join: ["/", [!Ref PrivateSubnet2Ip, !Ref SubnetBitmask]] | ||
Tags: | ||
- Key: Name | ||
Value: !Ref EnvironmentName | ||
VpcId: !Ref Vpc | ||
|
||
# EIPs | ||
Eip1: | ||
Type: AWS::EC2::EIP | ||
DependsOn: IgwAttachment | ||
Properties: | ||
Domain: vpc | ||
Tags: | ||
- Key: Name | ||
Value: !Ref EnvironmentName | ||
|
||
Eip2: | ||
Type: AWS::EC2::EIP | ||
DependsOn: IgwAttachment | ||
Properties: | ||
Domain: vpc | ||
Tags: | ||
- Key: Name | ||
Value: !Ref EnvironmentName | ||
# Gatways | ||
Ngw1: | ||
Type: AWS::EC2::NatGateway | ||
Properties: | ||
AllocationId: | ||
Fn::GetAtt: | ||
- Eip1 | ||
- AllocationId | ||
SubnetId: !Ref PublicSubnet1 | ||
Tags: | ||
- Key: Name | ||
Value: !Ref EnvironmentName | ||
|
||
Ngw2: | ||
Type: AWS::EC2::NatGateway | ||
Properties: | ||
AllocationId: | ||
Fn::GetAtt: | ||
- Eip2 | ||
- AllocationId | ||
SubnetId: !Ref PublicSubnet2 | ||
Tags: | ||
- Key: Name | ||
Value: !Ref EnvironmentName | ||
|
||
Igw: | ||
Type: AWS::EC2::InternetGateway | ||
Properties: | ||
Tags: | ||
- Key: Name | ||
Value: !Ref EnvironmentName | ||
|
||
IgwAttachment: | ||
Type: AWS::EC2::VPCGatewayAttachment | ||
Properties: | ||
InternetGatewayId: !Ref Igw | ||
VpcId: !Ref Vpc | ||
|
||
# Route Tables | ||
|
||
PrivateRouteTable1: | ||
Type: AWS::EC2::RouteTable | ||
Properties: | ||
Tags: | ||
- Key: Name | ||
Value: !Ref EnvironmentName | ||
VpcId: !Ref Vpc | ||
|
||
PrivateRouteTable2: | ||
Type: AWS::EC2::RouteTable | ||
Properties: | ||
Tags: | ||
- Key: Name | ||
Value: !Ref EnvironmentName | ||
VpcId: !Ref Vpc | ||
|
||
PublicRouteTable1: | ||
Type: AWS::EC2::RouteTable | ||
Properties: | ||
Tags: | ||
- Key: Name | ||
Value: !Ref EnvironmentName | ||
VpcId: !Ref Vpc | ||
|
||
# Route Table Association | ||
PrivateRouteTable1Association: | ||
Type: AWS::EC2::SubnetRouteTableAssociation | ||
Properties: | ||
RouteTableId: !Ref PrivateRouteTable1 | ||
SubnetId: !Ref PrivateSubnet1 | ||
|
||
PrivateRouteTable2Association: | ||
Type: AWS::EC2::SubnetRouteTableAssociation | ||
Properties: | ||
RouteTableId: !Ref PrivateRouteTable2 | ||
SubnetId: !Ref PrivateSubnet2 | ||
|
||
PublicRouteTable1Association: | ||
Type: AWS::EC2::SubnetRouteTableAssociation | ||
Properties: | ||
RouteTableId: !Ref PublicRouteTable1 | ||
SubnetId: !Ref PublicSubnet1 | ||
|
||
PublicRouteTable2Association: | ||
Type: AWS::EC2::SubnetRouteTableAssociation | ||
Properties: | ||
RouteTableId: !Ref PublicRouteTable1 | ||
SubnetId: !Ref PublicSubnet2 | ||
|
||
# Routes | ||
|
||
DefaultPrivateRoute1: | ||
Type: AWS::EC2::Route | ||
DependsOn: Igw | ||
Properties: | ||
DestinationCidrBlock: "0.0.0.0/0" | ||
NatGatewayId: !Ref Ngw1 | ||
RouteTableId: !Ref PrivateRouteTable1 | ||
|
||
DefaultPrivateRoute2: | ||
Type: AWS::EC2::Route | ||
Properties: | ||
DestinationCidrBlock: "0.0.0.0/0" | ||
NatGatewayId: !Ref Ngw2 | ||
RouteTableId: !Ref PrivateRouteTable2 | ||
|
||
DefaultPublicRoute1: | ||
Type: AWS::EC2::Route | ||
Properties: | ||
DestinationCidrBlock: "0.0.0.0/0" | ||
GatewayId: !Ref Igw | ||
RouteTableId: !Ref PublicRouteTable1 | ||
|
||
Outputs: | ||
|
||
Vpc: | ||
Description: "my VPC" | ||
Value: !Ref Vpc | ||
Export: | ||
Name: !Sub ${EnvironmentName}-Vpc | ||
SubnetBitmask: | ||
Description: "the subnet bitmask of all subnets" | ||
Value: !Ref SubnetBitmask | ||
Export: | ||
Name: !Sub ${EnvironmentName}-Subnet-Bitmask | ||
PrivateSubnet1: | ||
Description: "ID of private Subnet 1" | ||
Value: !Ref PrivateSubnet1 | ||
Export: | ||
Name: !Sub ${EnvironmentName}-Priv-Subnet-1 | ||
PrivateSubnet2: | ||
Description: "ID of private Subnet 2" | ||
Value: !Ref PrivateSubnet2 | ||
Export: | ||
Name: !Sub ${EnvironmentName}-Priv-Subnet-2 | ||
PublicSubnet1: | ||
Description: "ID of public Subnet 1" | ||
Value: !Ref PublicSubnet1 | ||
Export: | ||
Name: !Sub ${EnvironmentName}-Pub-Subnet-1 | ||
PublicSubnet2: | ||
Description: "ID of public Subnet 2" | ||
Value: !Ref PublicSubnet2 | ||
Export: | ||
Name: !Sub ${EnvironmentName}-Pub-Subnet-2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[ | ||
{ | ||
"ParameterKey": "EnvironmentName", | ||
"ParameterValue": "NDProject2" | ||
}, | ||
{ | ||
"ParameterKey": "S3Repo", | ||
"ParameterValue": "s3://udacity-project2-brn/udacity.zip" | ||
} | ||
] |
Oops, something went wrong.