-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathuser-data-ingress-client-sg.yml
52 lines (52 loc) · 1.85 KB
/
user-data-ingress-client-sg.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
---
AWSTemplateFormatVersion: '2010-09-09'
Description: 'cfn-modules test'
Parameters:
KeyName:
Description: 'Key name of the Linux user ec2-user to establish a SSH connection to the EC2 instance'
Type: String
Resources:
Vpc:
Type: 'AWS::CloudFormation::Stack'
Properties:
Parameters:
S3Endpoint: 'false' # speed up the example
DynamoDBEndpoint: 'false' # speed up the example
FlowLog: 'false' # speed up the example
TemplateURL: './node_modules/@cfn-modules/vpc/module.yml'
ClientSg:
Type: 'AWS::CloudFormation::Stack'
Properties:
Parameters:
VpcModule: !GetAtt 'Vpc.Outputs.StackName'
TemplateURL: './node_modules/@cfn-modules/client-sg/module.yml'
ServerInstance:
Type: 'AWS::CloudFormation::Stack'
Properties:
Parameters:
VpcModule: !GetAtt 'Vpc.Outputs.StackName'
SubnetReach: Private
UserData: |
yum install -y httpd
service httpd start
echo "cfn-modules" > /var/www/html/index.html
IngressTcpPort1: '80'
IngressTcpClientSgModule1: !GetAtt 'ClientSg.Outputs.StackName'
AmazonLinuxVersion: '2018.03.0.20181116'
InstanceType: 't3.nano'
TemplateURL: './node_modules/@cfn-modules/ec2-instance-amazon-linux/module.yml'
ClientInstance:
Type: 'AWS::CloudFormation::Stack'
Properties:
Parameters:
VpcModule: !GetAtt 'Vpc.Outputs.StackName'
KeyName: !Ref KeyName
AmazonLinuxVersion: '2018.03.0.20181116'
InstanceType: 't3.nano'
ClientSgModule1: !GetAtt 'ClientSg.Outputs.StackName'
TemplateURL: './node_modules/@cfn-modules/ec2-instance-amazon-linux/module.yml'
Outputs:
ClientPublicIpAddress:
Value: !GetAtt 'ClientInstance.Outputs.PublicIpAddress'
ServerPrivateIpAddress:
Value: !GetAtt 'ServerInstance.Outputs.PrivateIpAddress'