-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathaws-ec2-blueprint.yaml
157 lines (126 loc) · 4.88 KB
/
aws-ec2-blueprint.yaml
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
tosca_definitions_version: cloudify_dsl_1_4
description: >
This Blueprint installs the nodecellar application
on an amazon ec2 cloud environment.
imports:
- http://www.getcloudify.org/spec/cloudify/7.1.0.dev1/types.yaml
- plugin:cloudify-aws-plugin?version=1.4.10
- types/nodecellar.yaml
- types/aws-ec2-types.yaml
#####################################################################################
# inputs section allows the user to use same
# blueprint for creating different deployments, each one
# with its own parameters.
# to specify deployment inputs run:
# - cfy deployments create -b <blueprint_id> <deployment_id> -i inputs.json
#####################################################################################
inputs:
image:
description: >
Image to be used when launching agent VM's
size:
description: >
Flavor of the agent VM's
agent_user:
description: >
User for connecting to agent VM's
node_templates:
nodecellar:
type: nodecellar.nodes.NodecellarApplicationModule
relationships:
################################
# Setting the mongo connection
################################
- type: node_connected_to_mongo
target: mongod
################################
# Setting the nodejs connection
################################
- type: node_contained_in_nodejs
target: nodejs
mongod:
type: nodecellar.nodes.MonitoredMongoDatabase
relationships:
- type: cloudify.relationships.contained_in
target: mongod_host
nodejs:
type: nodecellar.nodes.NodeJSServer
relationships:
- type: cloudify.relationships.contained_in
target: nodejs_host
mongod_host:
type: nodecellar.nodes.MonitoredServer
relationships:
###########################################################
# Attaching the mongo security group to the mongo host
###########################################################
- type: cloudify.aws.relationships.instance_connected_to_security_group
target: mongod_security_group
nodejs_host:
type: nodecellar.nodes.MonitoredServer
relationships:
###########################################################
# Attaching a floating ip to the nodejs host
###########################################################
- type: cloudify.aws.relationships.instance_connected_to_elastic_ip
target: nodecellar_ip
###########################################################
# Attaching the nodecellar security group to the nodejs host
###########################################################
- type: cloudify.aws.relationships.instance_connected_to_security_group
target: nodecellar_security_group
###########################################################
# A security group to enable access to the mongo host
# using the port of the mongo node.
#
# We need this so that the nodecellar application can
# comminicate with MongoDB, since they are running on
# different hosts.
###########################################################
mongod_security_group:
type: cloudify.aws.nodes.SecurityGroup
properties:
description: Security Group for Mongo VMs
rules:
- ip_protocol: tcp
from_port: { get_property: [ mongod, port ] }
to_port: { get_property: [ mongod, port ] }
cidr_ip: 0.0.0.0/0
- ip_protocol: tcp
from_port: 28017
to_port: 28017
cidr_ip: 0.0.0.0/0
###########################################################
# A security group to enable access to the nodejs host
# using the port of the nodejs node.
#
# We need this so that the nodecellar application can
# receive web traffic.
###########################################################
nodecellar_security_group:
type: cloudify.aws.nodes.SecurityGroup
properties:
description: Security Group for Nodecellar VMs
rules:
- ip_protocol: tcp
from_port: { get_property: [ nodecellar, port ] }
to_port: { get_property: [ nodecellar, port ] }
cidr_ip: 0.0.0.0/0
###########################################################
# An ip to be attached to the nodejs host, since
# eventually we want to be able to access it
# from any machine, on any network.
###########################################################
nodecellar_ip:
type: cloudify.aws.nodes.ElasticIP
###########################################################
# This outputs section exposes the application endpoint.
# You can access it by running:
# - cfy deployments outputs <deployment_id>
###########################################################
outputs:
endpoint:
description: Web application endpoint
value:
ip_address: { get_attribute: [ nodecellar_ip, aws_resource_id ] }
port: { get_property: [ nodecellar, port ] }