Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 123 additions & 0 deletions ec2-vpc-blueprint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
tosca_definitions_version: cloudify_dsl_1_2

description: >
This blueprint defines a EC2 VPC VM created using Cloudify's AWS plugin
and a simple web server started using Cloudify's script plugin.
In addition a security group are created and associated with the created VM.

imports:
- http://www.getcloudify.org/spec/cloudify/3.4m4/types.yaml
- http://www.getcloudify.org/spec/aws-plugin/1.4/plugin.yaml
- http://www.getcloudify.org/spec/diamond-plugin/1.3.2/plugin.yaml

inputs:
webserver_port:
description: The HTTP web server port
default: 8080
agent_user:
description: User name used when SSH-ing into the started machine
default: ec2-user
image_id:
description: AWS EC2 image id to use for the server
instance_type:
description: AWS EC2 instance type to use for the server
default: m3.medium
vpc_id:
description: >
The VPC to deploy into
vpc_subnet_id:
description: >
The VPC subnet to deploy into.
This subnet must auto-assign public IPs and have an internet gateway

node_templates:
###########################################################
# The already existing VPC
###########################################################
vpc:
type: cloudify.aws.nodes.VPC
properties:
resource_id: { get_input: vpc_id }
use_external_resource: true
# We don't need this to be set but it is required by the schema
cidr_block: ''
###########################################################
# The already existing VPC subnet
###########################################################
vpc_subnet:
type: cloudify.aws.nodes.Subnet
properties:
resource_id: { get_input: vpc_subnet_id }
use_external_resource: true
# We don't need this to be set but it is required by the schema
cidr_block: ''
security_group:
type: cloudify.aws.nodes.SecurityGroup
properties:
description: Security group for Hello World VM
rules:
- ip_protocol: tcp
cidr_ip: 0.0.0.0/0
from_port: { get_property: [ http_web_server, port ] }
to_port: { get_property: [ http_web_server, port ] }
relationships:
- type: cloudify.aws.relationships.security_group_contained_in_vpc
target: vpc
vm:
type: cloudify.aws.nodes.Instance
properties:
cloudify_agent:
user: { get_input: agent_user }
image_id: { get_input: image_id }
instance_type: { get_input: instance_type }
relationships:
- type: cloudify.aws.relationships.instance_connected_to_security_group
target: security_group
- type: cloudify.aws.relationships.instance_contained_in_subnet
target: vpc_subnet
interfaces:
###########################################################
# We are infact telling cloudify to install a diamond
# monitoring agent on the server.
#
# (see https://github.com/BrightcoveOS/Diamond)
###########################################################
cloudify.interfaces.monitoring_agent:
install:
implementation: diamond.diamond_agent.tasks.install
inputs:
diamond_config:
interval: 1
start: diamond.diamond_agent.tasks.start
stop: diamond.diamond_agent.tasks.stop
uninstall: diamond.diamond_agent.tasks.uninstall
cloudify.interfaces.monitoring:
start:
implementation: diamond.diamond_agent.tasks.add_collectors
inputs:
collectors_config:
CPUCollector: {}
MemoryCollector: {}
LoadAverageCollector: {}
DiskUsageCollector:
config:
devices: x?vd[a-z]+[0-9]*$
NetworkCollector: {}
http_web_server:
type: cloudify.nodes.WebServer
properties:
port: { get_input: webserver_port }
relationships:
- type: cloudify.relationships.contained_in
target: vm
interfaces:
cloudify.interfaces.lifecycle:
configure: scripts/configure.sh
start: scripts/start.sh
stop: scripts/stop.sh

outputs:
http_endpoint:
description: Web server's external endpoint
value: { concat: ['http://', { get_attribute: [vm, public_ip_address] },
':', { get_property: [http_web_server, port] }] }