cf_factory 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/examples/base_vpc.rb +40 -0
- data/examples/cloudinit_script_for_one_instance.rb +77 -0
- data/examples/cloudinit_script_with_autoscaling.rb +85 -0
- data/examples/elb_with_cloudfront.rb +101 -0
- data/examples/instance_with_eip.rb +38 -0
- data/examples/instance_with_yum.rb +38 -0
- data/examples/just_an_instance.rb +29 -0
- data/examples/play_with_region_and_zones.rb +26 -0
- data/examples/ra_web_hosting.rb +146 -0
- data/examples/s3_with_cloudfront.rb +36 -0
- data/examples/test_vpc.rb +53 -0
- data/lib/cf_factory/as/cf_as_group.rb +75 -0
- data/lib/cf_factory/as/cf_as_launch_config.rb +53 -0
- data/lib/cf_factory/as/cf_as_scaling_policy.rb +33 -0
- data/lib/cf_factory/base/cf_base.rb +97 -0
- data/lib/cf_factory/base/cf_ec2_tag.rb +32 -0
- data/lib/cf_factory/base/cf_generator.rb +18 -0
- data/lib/cf_factory/base/cf_helper.rb +91 -0
- data/lib/cf_factory/base/cf_inner.rb +55 -0
- data/lib/cf_factory/base/cf_main.rb +101 -0
- data/lib/cf_factory/base/cf_mapping.rb +26 -0
- data/lib/cf_factory/base/cf_named_inner.rb +0 -0
- data/lib/cf_factory/base/cf_output.rb +24 -0
- data/lib/cf_factory/base/cf_parameter.rb +25 -0
- data/lib/cf_factory/base/cf_script_reader.rb +32 -0
- data/lib/cf_factory/cloudformation/cf_cloud_formation_init.rb +25 -0
- data/lib/cf_factory/cloudformation/cf_cloudformation_command.rb +37 -0
- data/lib/cf_factory/cloudformation/cf_cloudformation_commands.rb +25 -0
- data/lib/cf_factory/cloudformation/cf_cloudformation_config.rb +33 -0
- data/lib/cf_factory/cloudformation/cf_cloudformation_file.rb +38 -0
- data/lib/cf_factory/cloudformation/cf_cloudformation_files.rb +25 -0
- data/lib/cf_factory/cloudformation/cf_cloudformation_inner.rb +28 -0
- data/lib/cf_factory/cloudformation/cf_cloudformation_package.rb +34 -0
- data/lib/cf_factory/cloudformation/cf_cloudformation_packages.rb +42 -0
- data/lib/cf_factory/cloudformation/cf_cloudformation_sources.rb +30 -0
- data/lib/cf_factory/cloudformation/cf_init_script.rb +73 -0
- data/lib/cf_factory/cloudfront/cf_cache_behavior.rb +37 -0
- data/lib/cf_factory/cloudfront/cf_cache_behaviors.rb +28 -0
- data/lib/cf_factory/cloudfront/cf_cloudfront_distribution.rb +64 -0
- data/lib/cf_factory/cloudfront/cf_custom_origin_config.rb +37 -0
- data/lib/cf_factory/cloudfront/cf_default_cache_behavior.rb +32 -0
- data/lib/cf_factory/cloudfront/cf_distribution_config.rb +31 -0
- data/lib/cf_factory/cloudfront/cf_forwarded_values.rb +25 -0
- data/lib/cf_factory/cloudfront/cf_logging.rb +24 -0
- data/lib/cf_factory/cloudfront/cf_origin.rb +40 -0
- data/lib/cf_factory/cloudfront/cf_s3_origin_config.rb +25 -0
- data/lib/cf_factory/cloudwatch/cf_cloud_watch_alarm.rb +58 -0
- data/lib/cf_factory/ec2/cf_ebs_volume.rb +54 -0
- data/lib/cf_factory/ec2/cf_ec2_instance.rb +62 -0
- data/lib/cf_factory/ec2/cf_ec2_security_group.rb +40 -0
- data/lib/cf_factory/ec2/cf_ec2_security_group_egress.rb +28 -0
- data/lib/cf_factory/ec2/cf_ec2_security_group_ingress.rb +39 -0
- data/lib/cf_factory/ec2/cf_eip.rb +26 -0
- data/lib/cf_factory/ec2/cf_eip_association.rb +29 -0
- data/lib/cf_factory/elb/cf_app_cookie_stickiness_policy.rb +15 -0
- data/lib/cf_factory/elb/cf_elb.rb +49 -0
- data/lib/cf_factory/elb/cf_health_check.rb +23 -0
- data/lib/cf_factory/elb/cf_lb_cookie_stickiness_policy.rb +15 -0
- data/lib/cf_factory/elb/cf_listener.rb +26 -0
- data/lib/cf_factory/help/fixes.rb +14 -0
- data/lib/cf_factory/help/ip_mask.rb +165 -0
- data/lib/cf_factory/help/template_validation.rb +28 -0
- data/lib/cf_factory/iam/cf_iam_access_key.rb +32 -0
- data/lib/cf_factory/iam/cf_iam_group.rb +30 -0
- data/lib/cf_factory/iam/cf_iam_instance_profile.rb +30 -0
- data/lib/cf_factory/iam/cf_iam_policy.rb +18 -0
- data/lib/cf_factory/iam/cf_iam_role.rb +56 -0
- data/lib/cf_factory/iam/cf_iam_statement.rb +23 -0
- data/lib/cf_factory/iam/cf_iam_user.rb +34 -0
- data/lib/cf_factory/iam/cf_policy_document.rb +19 -0
- data/lib/cf_factory/modules/base_vpc.rb +61 -0
- data/lib/cf_factory/rds/cf_rds_instance.rb +53 -0
- data/lib/cf_factory/rds/cf_rds_security_group.rb +33 -0
- data/lib/cf_factory/rds/cf_rds_security_group_ingress.rb +29 -0
- data/lib/cf_factory/rds/cf_rds_subnet_group.rb +29 -0
- data/lib/cf_factory/route53/cf_elb_alias_target.rb +21 -0
- data/lib/cf_factory/route53/cf_record_set.rb +61 -0
- data/lib/cf_factory/route53/cf_route53_record_set.rb +61 -0
- data/lib/cf_factory/route53/cf_route53_record_set_group.rb +42 -0
- data/lib/cf_factory/s3/cf_s3_bucket.rb +32 -0
- data/lib/cf_factory/s3/cf_web_site_config.rb +24 -0
- data/lib/cf_factory/sqs/cf_sqs_queue.rb +26 -0
- data/lib/cf_factory/vpc/cf_attach_gateway.rb +28 -0
- data/lib/cf_factory/vpc/cf_internet_gateway.rb +30 -0
- data/lib/cf_factory/vpc/cf_network_acl.rb +39 -0
- data/lib/cf_factory/vpc/cf_network_acl_association.rb +24 -0
- data/lib/cf_factory/vpc/cf_network_acl_entry.rb +37 -0
- data/lib/cf_factory/vpc/cf_route.rb +43 -0
- data/lib/cf_factory/vpc/cf_route_table.rb +41 -0
- data/lib/cf_factory/vpc/cf_route_table_association.rb +24 -0
- data/lib/cf_factory/vpc/cf_subnet.rb +48 -0
- data/lib/cf_factory/vpc/cf_vpc.rb +64 -0
- data/lib/cf_factory.rb +103 -0
- metadata +140 -0
@@ -0,0 +1,40 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
require 'cf_factory'
|
4
|
+
|
5
|
+
cf = CfMain.new("Bla bla bla")
|
6
|
+
####### input parameters
|
7
|
+
parameter = CfParameter.new("KeyName", "Name of the key", "String", {"Default" => "majung"})
|
8
|
+
cf.add_parameter(parameter)
|
9
|
+
parameter2 = CfParameter.new("SecurityGroup", "Name of the security group", "String", {"Default" => "Blubber"})
|
10
|
+
cf.add_parameter(parameter2)
|
11
|
+
|
12
|
+
####### mappings
|
13
|
+
mapping = CfMapping.new("Default","AMI",{"us-east-1" => "ami-c6699baf", "us-west-2" => "ami-52ff7262"})
|
14
|
+
cf.add_mapping(mapping)
|
15
|
+
|
16
|
+
####### resources
|
17
|
+
#vpc
|
18
|
+
base_vpc = BaseVpc.new("BaseVpc","192.168.0.0/16",2,4,["eu-west-1a","eu-west-1b"],256)
|
19
|
+
base_vpc.add_to_template(cf)
|
20
|
+
vpc = base_vpc.vpc
|
21
|
+
|
22
|
+
network_acl = CfNetworkAcl.new("MyAcl1")
|
23
|
+
vpc.add_network_acl(network_acl)
|
24
|
+
network_acl_entry = CfNetworkAclEntry.new("Acl1", "110", "6", "ALLOW", false, "0.0.0.0/0", 80, 80)
|
25
|
+
network_acl.add_network_acl_entry(network_acl_entry)
|
26
|
+
|
27
|
+
####### output parameters
|
28
|
+
output = CfOutput.new("BaseVpc", "Id of the VPC", vpc.generate_ref())
|
29
|
+
cf.add_output(output)
|
30
|
+
|
31
|
+
cf_json = cf.generate
|
32
|
+
puts cf_json
|
33
|
+
|
34
|
+
config_options = YAML.load_file("aws_config.yml")
|
35
|
+
config_options["cloud_formation_endpoint"] = "cloudformation.us-east-1.amazonaws.com"
|
36
|
+
puts config_options.inspect
|
37
|
+
validator = TemplateValidation.new(cf_json, config_options)
|
38
|
+
validator.validate()
|
39
|
+
|
40
|
+
#puts "the reference for the VPC : #{vpc.generate_ref}"
|
@@ -0,0 +1,77 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
require 'cf_factory'
|
4
|
+
|
5
|
+
cf = CfMain.new("Playground")
|
6
|
+
##########################
|
7
|
+
ami = "ami-1624987f"
|
8
|
+
|
9
|
+
input_keyname = CfParameter.new("KeyName","Name of key for SSH access","String",{"Default" => "majung"})
|
10
|
+
cf.add_parameter(input_keyname)
|
11
|
+
input_ami = CfParameter.new("AMI","ID of AMI for instance","String",{"Default" => ami})
|
12
|
+
cf.add_parameter(input_ami)
|
13
|
+
|
14
|
+
statement = CfIamStatement.new("Allow","cloudformation:DescribeStackResource","*")
|
15
|
+
role_policy = CfIamPolicy.new("MyRolePolicy", CfPolicyDocument.new([statement]))
|
16
|
+
iam_user = CfIamUser.new("IamUser","/",{:policies => [role_policy]})
|
17
|
+
cf.add_resource(iam_user)
|
18
|
+
iam_access_key = CfIamAccessKey.new("IamAccessKey",iam_user.generate_ref,"Active")
|
19
|
+
cf.add_resource(iam_access_key)
|
20
|
+
|
21
|
+
script = CfInitScript.create_basic("MyInstance",iam_access_key.generate_ref,iam_access_key.retrieve_attribute("SecretAccessKey"))
|
22
|
+
#full_init_script = script.user_data()
|
23
|
+
|
24
|
+
full_init_script = CfHelper.join([
|
25
|
+
"#!/bin/bash -v\\n",
|
26
|
+
"yum update -y aws-cfn-bootstrap\\n",
|
27
|
+
"/opt/aws/bin/cfn-init -s ", CfHelper.generate_ref("AWS::StackName"),
|
28
|
+
" -r ", "MyInstance ",
|
29
|
+
" --access-key ", iam_access_key.generate_ref,
|
30
|
+
" --secret-key ", iam_access_key.retrieve_attribute("SecretAccessKey")]
|
31
|
+
)
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
instance = CfEc2Instance.new("MyInstance",input_ami.generate_ref,"m1.small",
|
36
|
+
{:keyname => input_keyname.generate_ref(),
|
37
|
+
:user_data => full_init_script
|
38
|
+
}
|
39
|
+
)
|
40
|
+
packages = CfCloudFormationPackages.new([CfCloudFormationPackage.new("yum","httpd","2.2.13")])
|
41
|
+
commands = CfCloudFormationCommands.new([
|
42
|
+
CfCloudFormationCommand.new("command1","echo cloudinit"),
|
43
|
+
CfCloudFormationCommand.new("command2","echo cloudinit > /var/log/my-cloudinit.txt")
|
44
|
+
])
|
45
|
+
config1 = CfCloudFormationConfig.new("config1", nil, commands, nil, packages)
|
46
|
+
config2 = CfCloudFormationConfig.new("config", nil, commands, nil, nil)
|
47
|
+
|
48
|
+
meta_data = CfCloudFormationInit.new([config2])
|
49
|
+
instance.set_meta_data(meta_data)
|
50
|
+
cf.add_resource(instance)
|
51
|
+
|
52
|
+
stackname = CfOutput.new("StackName","Name of CloudFormation stack",CfHelper.generate_ref("AWS::StackName"))
|
53
|
+
cf.add_output(stackname)
|
54
|
+
instance_ip = CfOutput.new("InstanceIp","DNS Name of instance created",instance.retrieve_attribute("PublicDnsName"))
|
55
|
+
cf.add_output(instance_ip)
|
56
|
+
access_key = CfOutput.new("AccessKey","Access key",iam_access_key.generate_ref)
|
57
|
+
cf.add_output(access_key)
|
58
|
+
secret_key = CfOutput.new("SecretKey","Secret key",iam_access_key.retrieve_attribute("SecretAccessKey"))
|
59
|
+
cf.add_output(secret_key)
|
60
|
+
|
61
|
+
output_command = CfOutput.new("FullCommand", "Full command to be executed",
|
62
|
+
CfHelper.join(["/opt/aws/bin/cfn-init -s ", CfHelper.generate_ref("AWS::StackName"),
|
63
|
+
" -r ", instance.get_name(),
|
64
|
+
" --access-key ", iam_access_key.generate_ref,
|
65
|
+
" --secret-key ", iam_access_key.retrieve_attribute("SecretAccessKey")]
|
66
|
+
))
|
67
|
+
cf.add_output(output_command)
|
68
|
+
|
69
|
+
##########################
|
70
|
+
cf_json = cf.generate
|
71
|
+
puts cf_json
|
72
|
+
|
73
|
+
config_options = YAML.load_file("aws_config.yml")
|
74
|
+
config_options["cloud_formation_endpoint"] = "cloudformation.us-east-1.amazonaws.com"
|
75
|
+
validator = TemplateValidation.new(cf_json, config_options)
|
76
|
+
validator.validate()
|
77
|
+
|
@@ -0,0 +1,85 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
require 'cf_factory'
|
4
|
+
|
5
|
+
cf = CfMain.new("Playground")
|
6
|
+
##########################
|
7
|
+
ami = "ami-1624987f"
|
8
|
+
|
9
|
+
input_keyname = CfParameter.new("KeyName","Name of key for SSH access","String",{"Default" => "majung"})
|
10
|
+
cf.add_parameter(input_keyname)
|
11
|
+
input_ami = CfParameter.new("AMI","ID of AMI for instance","String",{"Default" => ami})
|
12
|
+
cf.add_parameter(input_ami)
|
13
|
+
|
14
|
+
statement = CfIamStatement.new("Allow","cloudformation:DescribeStackResource","*")
|
15
|
+
role_policy = CfIamPolicy.new("MyRolePolicy", CfPolicyDocument.new([statement]))
|
16
|
+
iam_user = CfIamUser.new("IamUser","/",{:policies => [role_policy]})
|
17
|
+
cf.add_resource(iam_user)
|
18
|
+
iam_access_key = CfIamAccessKey.new("IamAccessKey",iam_user.generate_ref,"Active")
|
19
|
+
cf.add_resource(iam_access_key)
|
20
|
+
|
21
|
+
script = CfInitScript.create_basic("MyInstance",iam_access_key.generate_ref,iam_access_key.retrieve_attribute("SecretAccessKey"))
|
22
|
+
#full_init_script = script.user_data()
|
23
|
+
full_init_script = CfHelper.join([
|
24
|
+
"#!/bin/bash -v\\n",
|
25
|
+
"yum update -y aws-cfn-bootstrap\\n",
|
26
|
+
"/opt/aws/bin/cfn-init -s ", CfHelper.generate_ref("AWS::StackName"),
|
27
|
+
" -r ", "InstanceLaunchConfig ",
|
28
|
+
" --access-key ", iam_access_key.generate_ref,
|
29
|
+
" --secret-key ", iam_access_key.retrieve_attribute("SecretAccessKey")]
|
30
|
+
)
|
31
|
+
|
32
|
+
packages = CfCloudFormationPackages.new([CfCloudFormationPackage.new("yum","httpd","2.2.13")])
|
33
|
+
commands = CfCloudFormationCommands.new([
|
34
|
+
CfCloudFormationCommand.new("command1","echo cloudinit"),
|
35
|
+
CfCloudFormationCommand.new("command2","echo cloudinit > /var/log/my-cloudinit.txt")
|
36
|
+
])
|
37
|
+
config1 = CfCloudFormationConfig.new("config1", nil, commands, nil, packages)
|
38
|
+
config2 = CfCloudFormationConfig.new("config", nil, commands, nil, nil)
|
39
|
+
|
40
|
+
#auto-scaling group
|
41
|
+
launch_config = CfAsLaunchConfig.new("InstanceLaunchConfig", input_ami.generate_ref, "t1.micro", { :key_name => input_keyname.generate_ref(), :user_data => full_init_script})
|
42
|
+
meta_data = CfCloudFormationInit.new([config2])
|
43
|
+
launch_config.set_meta_data(meta_data)
|
44
|
+
cf.add_resource(launch_config)
|
45
|
+
availability_zones = CfHelper.az_array_in_region(["b","c"])
|
46
|
+
as_group = CfAsGroup.new("AppServerFleet",availability_zones, launch_config, [], 4 ,2 ,{:desired_capacity => 2})
|
47
|
+
cf.add_resource(as_group)
|
48
|
+
as_up_scaling_policy = CfAsScalingPolicy.new("MyUpscalePolicy",as_group,"ChangeInCapacity","1",{:cooldown => 300})
|
49
|
+
cf.add_resource(as_up_scaling_policy)
|
50
|
+
as_down_scaling_policy = CfAsScalingPolicy.new("MyDownscalePolicy",as_group,"ChangeInCapacity","-1",{:cooldown => 300})
|
51
|
+
cf.add_resource(as_down_scaling_policy)
|
52
|
+
as_up_alarm = CfCloudWatchAlarm.new("MyUpAlarm",CfCloudWatchAlarm::GREATER_THAN_OR_EQUAL_TO_THRESHOLD, "3", "CPUUtilization","AWS/EC2",
|
53
|
+
"60","Average","80", {:alarm_actions => [as_up_scaling_policy]})
|
54
|
+
as_down_alarm = CfCloudWatchAlarm.new("MyDownAlarm",CfCloudWatchAlarm::LESS_THAN_THRESHOLD, "3", "CPUUtilization","AWS/EC2",
|
55
|
+
"60","Average","30", {:alarm_actions => [as_down_scaling_policy]})
|
56
|
+
cf.add_resource(as_up_alarm)
|
57
|
+
cf.add_resource(as_down_alarm)
|
58
|
+
|
59
|
+
stackname = CfOutput.new("StackName","Name of CloudFormation stack",CfHelper.generate_ref("AWS::StackName"))
|
60
|
+
cf.add_output(stackname)
|
61
|
+
access_key = CfOutput.new("AccessKey","Access key",iam_access_key.generate_ref)
|
62
|
+
cf.add_output(access_key)
|
63
|
+
secret_key = CfOutput.new("SecretKey","Secret key",iam_access_key.retrieve_attribute("SecretAccessKey"))
|
64
|
+
cf.add_output(secret_key)
|
65
|
+
|
66
|
+
output_command = CfOutput.new("FullCommand", "Full command to be executed",
|
67
|
+
CfHelper.join(["/opt/aws/bin/cfn-init -s ", CfHelper.generate_ref("AWS::StackName"),
|
68
|
+
" -r ", launch_config.get_name(),
|
69
|
+
" --access-key ", iam_access_key.generate_ref,
|
70
|
+
" --secret-key ", iam_access_key.retrieve_attribute("SecretAccessKey")]
|
71
|
+
))
|
72
|
+
cf.add_output(output_command)
|
73
|
+
|
74
|
+
tag = CfEc2Tag.new("CloudFormationTests","active")
|
75
|
+
cf.apply_tags_to_all_resources([tag])
|
76
|
+
|
77
|
+
##########################
|
78
|
+
cf_json = cf.generate
|
79
|
+
puts cf_json
|
80
|
+
|
81
|
+
config_options = YAML.load_file("aws_config.yml")
|
82
|
+
config_options["cloud_formation_endpoint"] = "cloudformation.us-east-1.amazonaws.com"
|
83
|
+
validator = TemplateValidation.new(cf_json, config_options)
|
84
|
+
validator.validate()
|
85
|
+
|
@@ -0,0 +1,101 @@
|
|
1
|
+
require 'help/include_libraries'
|
2
|
+
|
3
|
+
# CloudFormation template for Atraveo. 2-Tiered web-application with load-balancing.
|
4
|
+
cf = CfMain.new("CloudFront with ELB as origin with dynamic content")
|
5
|
+
app_port = 8080
|
6
|
+
key_name = "default"
|
7
|
+
app_server_ami = "ami-c6699baf"
|
8
|
+
spot_price = "0.02"
|
9
|
+
|
10
|
+
####### input parameters
|
11
|
+
param_app_server_ami = CfParameter.new("AppServerAmi", "AMI of App-Server", "String")
|
12
|
+
cf.add_parameter(param_app_server_ami)
|
13
|
+
param_app_server_key = CfParameter.new("AppServerKey", "Key used to start App-Server", "String")
|
14
|
+
cf.add_parameter(param_app_server_key)
|
15
|
+
param_app_port = CfParameter.new("AppPort", "Port of the Web/App-Servers", "Number", {"Default" => "8080"})
|
16
|
+
cf.add_parameter(param_app_port)
|
17
|
+
|
18
|
+
zone = "us-east"
|
19
|
+
|
20
|
+
####### mappings
|
21
|
+
|
22
|
+
####### resources
|
23
|
+
|
24
|
+
#VPC/subnets: all public to be able to be able to connect the instances by adding an EIP
|
25
|
+
#VPC, IGW, and route tables
|
26
|
+
vpc = CfVpc.new("10.10.0.0/16")
|
27
|
+
cf.add_vpc(vpc)
|
28
|
+
igw = CfInternetGateway.new("MyInternetGateway", vpc)
|
29
|
+
vpc.add_internet_gateway(igw)
|
30
|
+
public_route_table = CfRouteTable.new("InternetRouteTable")
|
31
|
+
igw_route = CfRoute.new("IgwRoute", "0.0.0.0/0", igw)
|
32
|
+
public_route_table.add_route(igw_route)
|
33
|
+
vpc.add_route_table(public_route_table)
|
34
|
+
|
35
|
+
# subnets
|
36
|
+
subnet_elb_a = CfSubnet.new("SubnetElbA", "10.10.1.0/24", "#{zone}-1c", public_route_table)
|
37
|
+
vpc.add_subnet(subnet_elb_a)
|
38
|
+
subnet_elb_b = CfSubnet.new("SubnetElbB", "10.10.2.0/24", "#{zone}-1b", public_route_table)
|
39
|
+
vpc.add_subnet(subnet_elb_b)
|
40
|
+
subnet_web_a = CfSubnet.new("SubnetWebA", "10.10.3.0/24", "#{zone}-1c", public_route_table)
|
41
|
+
vpc.add_subnet(subnet_web_a)
|
42
|
+
subnet_web_b = CfSubnet.new("SubnetWebB", "10.10.4.0/24", "#{zone}-1b", public_route_table)
|
43
|
+
vpc.add_subnet(subnet_web_b)
|
44
|
+
|
45
|
+
#security groups
|
46
|
+
elb_security_group_name = "ElbSecurityGroup"
|
47
|
+
elb_sec_group = CfEc2SecurityGroup.new(elb_security_group_name, "Group for ELB", vpc)
|
48
|
+
elb_sec_group.add_ingress_rule(CfEc2SecurityGroupIngress.new("tcp", 80, 80, "0.0.0.0/0"))
|
49
|
+
elb_sec_group.add_ingress_rule(CfEc2SecurityGroupIngress.new("tcp", 443, 443, "0.0.0.0/0"))
|
50
|
+
cf.add_resource(elb_sec_group)
|
51
|
+
|
52
|
+
app_security_group_name = "AppSecurityGroup"
|
53
|
+
app_sec_group = CfEc2SecurityGroup.new(app_security_group_name, "Group for web and app", vpc)
|
54
|
+
app_sec_group.add_ingress_rule(CfEc2SecurityGroupIngress.new("tcp", 22, 22, "0.0.0.0/0"))
|
55
|
+
app_sec_group.add_ingress_rule(CfEc2SecurityGroupIngress.new("tcp", param_app_port.generate_ref(), param_app_port.generate_ref(), nil, elb_sec_group))
|
56
|
+
cf.add_resource(app_sec_group)
|
57
|
+
|
58
|
+
#application servers (one in each region)
|
59
|
+
options = {}
|
60
|
+
instance_a = CfEc2Instance.new("InstanceA",param_app_server_ami.generate_ref, "t1.micro", {:subnet => subnet_web_a, :vpc_security_groups => [app_sec_group]})
|
61
|
+
instance_b = CfEc2Instance.new("InstanceB",param_app_server_ami.generate_ref, "t1.micro", {:subnet => subnet_web_b, :vpc_security_groups => [app_sec_group]})
|
62
|
+
cf.add_resource(instance_a)
|
63
|
+
cf.add_resource(instance_b)
|
64
|
+
|
65
|
+
#elb
|
66
|
+
#health_check_string = "HTTP:#{param_app_port.generate_ref()}/index.html"
|
67
|
+
health_check_string = "HTTP:80/index.html"
|
68
|
+
elb = CfElb.new("MyLoadBalancer", {
|
69
|
+
:subnets => [subnet_elb_a, subnet_elb_b],
|
70
|
+
#:app_cookie_stickiness_policy => [CfAppCookieStickinessPolicy.new("cookiename","policybla")],
|
71
|
+
:health_check => CfHealthCheck.new("3","60", health_check_string,"10","2"),
|
72
|
+
:listeners => [CfListener.new(param_app_port.generate_ref(),"http","80","http")],
|
73
|
+
:security_groups => [elb_sec_group],
|
74
|
+
:instances => [instance_a, instance_b]
|
75
|
+
}
|
76
|
+
)
|
77
|
+
cf.add_resource(elb)
|
78
|
+
|
79
|
+
#cloudfront
|
80
|
+
origin = CfCustomOriginConfig.new("http-only",:http_port => 80)
|
81
|
+
origin_config = CfOrigin.new(elb.retrieve_attribute("DNSName") ,"CF001", origin)
|
82
|
+
default_cache_behavior = CfDefaultCacheBehavior.new(origin_config.id,CfForwardedValues.new(true),"allow-all",{:min_ttl => 0})
|
83
|
+
distribution_details = CfDistributionConfig.new([origin_config],default_cache_behavior,true)
|
84
|
+
cloudfront_distribution = CfCloudfrontDistribution.new("MyDistribution",distribution_details)
|
85
|
+
cf.add_resource(cloudfront_distribution)
|
86
|
+
|
87
|
+
####### output parameters
|
88
|
+
elb_output = CfOutput.new("ElbEndpoint","Endpoint of the ELB",elb.retrieve_attribute("DNSName"))
|
89
|
+
cf.add_output(elb_output)
|
90
|
+
cloudfront_domain = CfOutput.new("CloudfrontDomain", "Endpoint of the CloudFront distribution", cloudfront_distribution.retrieve_attribute("DomainName"))
|
91
|
+
cf.add_output(cloudfront_domain)
|
92
|
+
|
93
|
+
cf_json = cf.generate
|
94
|
+
puts cf_json
|
95
|
+
|
96
|
+
config_options = YAML.load_file("aws_config.yml")
|
97
|
+
validator = TemplateValidation.new(cf_json, config_options)
|
98
|
+
validator.validate()
|
99
|
+
validator.apply({"AppServerAmi" => "ami-e96bdf80", "AppServerKey" => "majung", "AppPort" => "80"})
|
100
|
+
|
101
|
+
#puts "the reference for the VPC : #{vpc.generate_ref}"
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'help/include_libraries'
|
2
|
+
|
3
|
+
cf = CfMain.new("Playground")
|
4
|
+
##########################
|
5
|
+
|
6
|
+
mapping = CfMapping.new("Region2AmiMapping","AMI", {
|
7
|
+
"us-east-1" => "ami-c6699baf",
|
8
|
+
"us-west-2" => "ami-52ff7262",
|
9
|
+
"us-west-1" => "ami-3bcc9e7e",
|
10
|
+
"eu-west-1" => "ami-0b5b6c7f",
|
11
|
+
"ap-southeast-1" => "ami-02eb9350",
|
12
|
+
"ap-northeast-1" => "ami-14d86d15",
|
13
|
+
"sa-east-1" => "ami-0439e619"
|
14
|
+
})
|
15
|
+
cf.add_mapping(mapping)
|
16
|
+
ami = mapping.map_from_region()
|
17
|
+
instance = CfEc2Instance.new("MyInstance", ami, "t1.micro")
|
18
|
+
cf.add_resource(instance)
|
19
|
+
eip = CfEip.new("MyEip",instance)
|
20
|
+
cf.add_resource(eip)
|
21
|
+
instance_ip_assoc = CfEipAssociation.new("MyEipAllocation", eip, instance, nil)
|
22
|
+
cf.add_resource(instance_ip_assoc)
|
23
|
+
|
24
|
+
eip_output = CfOutput.new("Eip", "Id of the EIP", eip.generate_ref())
|
25
|
+
cf.add_output(eip_output)
|
26
|
+
#eip_ip_output = CfOutput.new("Eip", "Id of the EIP", eip.retrieve_attribute("AllocationId")) only works for VPC
|
27
|
+
#cf.add_output(eip_ip_output)
|
28
|
+
assoc_output = CfOutput.new("Assoc", "Id of the Assoc", instance_ip_assoc.generate_ref())
|
29
|
+
cf.add_output(assoc_output)
|
30
|
+
##########################
|
31
|
+
cf_json = cf.generate
|
32
|
+
puts cf_json
|
33
|
+
|
34
|
+
config_options = YAML.load_file("aws_config.yml")
|
35
|
+
validator = TemplateValidation.new(cf_json, config_options)
|
36
|
+
validator.validate()
|
37
|
+
validator.apply()
|
38
|
+
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'help/include_libraries'
|
2
|
+
|
3
|
+
cf = CfMain.new("Playground")
|
4
|
+
##########################
|
5
|
+
|
6
|
+
mapping = CfMapping.new("Region2AmiMapping","AMI", {
|
7
|
+
"us-east-1" => "ami-c6699baf",
|
8
|
+
"us-west-2" => "ami-52ff7262",
|
9
|
+
"us-west-1" => "ami-3bcc9e7e",
|
10
|
+
"eu-west-1" => "ami-c37474b7",#"ami-0b5b6c7f",
|
11
|
+
"ap-southeast-1" => "ami-02eb9350",
|
12
|
+
"ap-northeast-1" => "ami-14d86d15",
|
13
|
+
"sa-east-1" => "ami-0439e619"
|
14
|
+
})
|
15
|
+
cf.add_mapping(mapping)
|
16
|
+
ami = mapping.map_from_region()
|
17
|
+
puts "AMI = #{ami}"
|
18
|
+
instance = CfEc2Instance.new("MyInstance", ami, "t1.micro", {:keyname => "majung-eu"})
|
19
|
+
cf.add_resource(instance)
|
20
|
+
|
21
|
+
packages = CfCloudFormationPackages.new([
|
22
|
+
CfCloudFormationPackage.new("yum", "rubygems", []),
|
23
|
+
CfCloudFormationPackage.new("yum", "rubygem-aws-sdk", []),
|
24
|
+
CfCloudFormationPackage.new("rubygems", "cloudyscripts", ["2.14.60"])
|
25
|
+
])
|
26
|
+
config = CfCloudFormationConfig.new("GemInstallation", nil, nil, nil, packages)
|
27
|
+
cloud_init_config = CfCloudFormationInit.new([config])
|
28
|
+
instance.set_meta_data(cloud_init_config)
|
29
|
+
|
30
|
+
##########################
|
31
|
+
cf_json = cf.generate
|
32
|
+
puts cf_json
|
33
|
+
|
34
|
+
config_options = YAML.load_file("aws_config.yml")
|
35
|
+
validator = TemplateValidation.new(cf_json, config_options)
|
36
|
+
validator.validate()
|
37
|
+
#validator.apply()
|
38
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'help/include_libraries'
|
2
|
+
|
3
|
+
cf = CfMain.new("JustAnInstance")
|
4
|
+
##########################
|
5
|
+
|
6
|
+
mapping = CfMapping.new("Region2AmiMapping","AMI", {
|
7
|
+
"us-east-1" => "ami-c6699baf",
|
8
|
+
"us-west-2" => "ami-52ff7262",
|
9
|
+
"us-west-1" => "ami-3bcc9e7e",
|
10
|
+
"eu-west-1" => "ami-0b5b6c7f",
|
11
|
+
"ap-southeast-1" => "ami-02eb9350",
|
12
|
+
"ap-northeast-1" => "ami-14d86d15",
|
13
|
+
"sa-east-1" => "ami-0439e619"
|
14
|
+
})
|
15
|
+
cf.add_mapping(mapping)
|
16
|
+
ami = mapping.map_from_region()
|
17
|
+
puts "AMI = #{ami}"
|
18
|
+
instance = CfEc2Instance.new("MyInstance", ami, "t1.micro")
|
19
|
+
cf.add_resource(instance)
|
20
|
+
|
21
|
+
##########################
|
22
|
+
cf_json = cf.generate
|
23
|
+
puts cf_json
|
24
|
+
|
25
|
+
config_options = YAML.load_file("aws_config.yml")
|
26
|
+
validator = TemplateValidation.new(cf_json, config_options)
|
27
|
+
validator.validate()
|
28
|
+
validator.apply()
|
29
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'help/include_libraries'
|
2
|
+
|
3
|
+
cf = CfMain.new("Playground")
|
4
|
+
##########################
|
5
|
+
ami = "ami-6d555119"
|
6
|
+
|
7
|
+
az = CfHelper.az_in_region("a")
|
8
|
+
instance = CfEc2Instance.new("MyInstance", ami, "t1.micro", {:availability_zone => az })
|
9
|
+
cf.add_resource(instance)
|
10
|
+
|
11
|
+
region_output = CfOutput.new("Region", "Region the stack was started", CfHelper.ref_current_region())
|
12
|
+
cf.add_output(region_output)
|
13
|
+
target_zone_output = CfOutput.new("TargetZone", "AZ where instance to be started", az)
|
14
|
+
cf.add_output(target_zone_output)
|
15
|
+
actual_zone_output = CfOutput.new("ActualInstanceZone", "AZ of started instance", instance.retrieve_attribute("AvailabilityZone"))
|
16
|
+
cf.add_output(actual_zone_output)
|
17
|
+
|
18
|
+
##########################
|
19
|
+
cf_json = cf.generate
|
20
|
+
puts cf_json
|
21
|
+
|
22
|
+
config_options = YAML.load_file("aws_config.yml")
|
23
|
+
validator = TemplateValidation.new(cf_json, config_options)
|
24
|
+
validator.validate()
|
25
|
+
validator.apply()
|
26
|
+
|
@@ -0,0 +1,146 @@
|
|
1
|
+
require 'help/include_libraries'
|
2
|
+
|
3
|
+
# CloudFormation template for Atraveo. 2-Tiered web-application with load-balancing.
|
4
|
+
cf = CfMain.new("Reference Architecture Web-Hosting")
|
5
|
+
|
6
|
+
####### input parameters
|
7
|
+
hosted_zone_id = "ZSSFB90C439AA"
|
8
|
+
hosted_zone_name = "dezidr.com"
|
9
|
+
|
10
|
+
#ami_id = "ami-c6699baf"
|
11
|
+
#ami_id = "ami-e96bdf80" #eu-west NAT instance
|
12
|
+
ami_id = "ami-e96bdf80" #us-east web-server returning something
|
13
|
+
|
14
|
+
param_hosted_zone = CfParameter.new("HostedZoneId", "Needs an existing hosted zone in Route53 to be configured", "String", {"Default" => hosted_zone_id})
|
15
|
+
cf.add_parameter(param_hosted_zone)
|
16
|
+
param_app_server_ami = CfParameter.new("AppServerAmi", "AMI of App-Server", "String", {"Default" => ami_id})
|
17
|
+
cf.add_parameter(param_app_server_ami)
|
18
|
+
param_app_server_key = CfParameter.new("AppServerKey", "Key used to start App-Server", "String")
|
19
|
+
cf.add_parameter(param_app_server_key)
|
20
|
+
param_app_port = CfParameter.new("AppPort", "Port of the Web/App-Servers", "Number", {"Default" => "8080"})
|
21
|
+
cf.add_parameter(param_app_port)
|
22
|
+
param_db_user = CfParameter.new("MasterUserName", "Name of the master user name of the DB", "String", {"Default" => "masteruser"})
|
23
|
+
cf.add_parameter(param_db_user)
|
24
|
+
param_db_pw = CfParameter.new("MasterPassword", "Password of the master user of the DB", "String")
|
25
|
+
cf.add_parameter(param_db_pw)
|
26
|
+
|
27
|
+
zone = "us-east"
|
28
|
+
|
29
|
+
####### mappings
|
30
|
+
|
31
|
+
####### resources
|
32
|
+
|
33
|
+
#ebs test
|
34
|
+
ebs = CfEbsVolume.create_normal("MyEbs",CfHelper.az_in_region(az_id = "b"), 5)
|
35
|
+
cf.add_resource(ebs)
|
36
|
+
|
37
|
+
s3_bucket = CfS3Bucket.new("MyS3Bucket")
|
38
|
+
cf.add_resource(s3_bucket)
|
39
|
+
s3_log_bucket = CfS3Bucket.new("MyS3LogBucket")
|
40
|
+
s3_log_bucket.set_deletion_policy("Delete")
|
41
|
+
cf.add_resource(s3_log_bucket)
|
42
|
+
|
43
|
+
#security groups
|
44
|
+
# ELB security groups apparently only available for VPC
|
45
|
+
#elb_sec_group = CfEc2SecurityGroup.new("ElbSecurityGroup", "Security Group for ELB")
|
46
|
+
#elb_sec_group.add_ingress_rule(CfEc2SecurityGroupIngress.new("tcp", 80, 80, "0.0.0.0/0"))
|
47
|
+
#elb_sec_group.add_ingress_rule(CfEc2SecurityGroupIngress.new("tcp", 443, 443, "0.0.0.0/0"))
|
48
|
+
#cf.add_resource(elb_sec_group)
|
49
|
+
|
50
|
+
#elb
|
51
|
+
#health_check_string = "HTTP:#{param_app_port.generate_ref()}/index.html"
|
52
|
+
health_check_string = "HTTP:80/index.html"
|
53
|
+
elb = CfElb.new("MyLoadBalancer", {
|
54
|
+
:health_check => CfHealthCheck.new("3","60", health_check_string,"10","2"),
|
55
|
+
:listeners => [CfListener.new(param_app_port.generate_ref(),"http","80","http")],
|
56
|
+
#:security_groups => [elb_sec_group], #only for VPC based ELBs
|
57
|
+
:availability_zones => CfHelper.availability_zones()
|
58
|
+
}
|
59
|
+
)
|
60
|
+
cf.add_resource(elb)
|
61
|
+
|
62
|
+
app_sec_group = CfEc2SecurityGroup.new("AppSecurityGroup", "Security Group for web and app")
|
63
|
+
app_sec_group.add_ingress_rule(CfEc2SecurityGroupIngress.new("tcp", 22, 22, "0.0.0.0/0"))
|
64
|
+
ir1 = CfEc2SecurityGroupIngress.new("tcp", param_app_port.generate_ref(), param_app_port.generate_ref(), "0.0.0.0/0")
|
65
|
+
app_sec_group.add_ingress_rule(ir1)
|
66
|
+
cf.add_resource(app_sec_group)
|
67
|
+
|
68
|
+
rds_sec_group = CfRdsSecurityGroup.new("RdsSecurityGroup","Security Group for RDS")
|
69
|
+
ir = CfRdsSecurityGroupIngress.new(nil,app_sec_group)
|
70
|
+
ir.set_use_sg_id(false)
|
71
|
+
rds_sec_group.add_rule(ir)
|
72
|
+
cf.add_resource(rds_sec_group)
|
73
|
+
|
74
|
+
#rds
|
75
|
+
rds_endpoint= "rdsendpoint"
|
76
|
+
options = {:multi_az => true, :security_groups => [rds_sec_group]}
|
77
|
+
rds_instance = CfRdsInstance.new("MyDatabase",5,"MySql","db.t1.micro",param_db_user.generate_ref(), param_db_pw.generate_ref, options)
|
78
|
+
cf.add_resource(rds_instance)
|
79
|
+
rds_endpoint = rds_instance.retrieve_attribute("Endpoint.Address")
|
80
|
+
|
81
|
+
#iam-role to be able to read meta-data
|
82
|
+
statement = CfIamStatement.new("Allow","cloudformation:DescribeStackResource","*")
|
83
|
+
role_policy = CfIamPolicy.new("MyRolePolicy", CfPolicyDocument.new([statement]))
|
84
|
+
iam_role = CfIamRole.new("ReadMetaData","/",{:policies => [role_policy]})
|
85
|
+
cf.add_resource(iam_role)
|
86
|
+
|
87
|
+
#auto-scaling group
|
88
|
+
launch_config = CfAsLaunchConfig.new("AppServerLaunchConfig", ami_id, "t1.micro", {:security_groups => [app_sec_group], :user_data => rds_endpoint})
|
89
|
+
cf.add_resource(launch_config)
|
90
|
+
availability_zones = CfHelper.az_array_in_region(["b","c"])
|
91
|
+
as_group = CfAsGroup.new("AppServerFleet",availability_zones, launch_config, [elb], 4 ,2 ,{:desired_capacity => 2})
|
92
|
+
cf.add_resource(as_group)
|
93
|
+
as_up_scaling_policy = CfAsScalingPolicy.new("MyUpscalePolicy",as_group,"ChangeInCapacity","1",{:cooldown => 300})
|
94
|
+
cf.add_resource(as_up_scaling_policy)
|
95
|
+
as_down_scaling_policy = CfAsScalingPolicy.new("MyDownscalePolicy",as_group,"ChangeInCapacity","-1",{:cooldown => 300})
|
96
|
+
cf.add_resource(as_down_scaling_policy)
|
97
|
+
as_up_alarm = CfCloudWatchAlarm.new("MyUpAlarm",CfCloudWatchAlarm::GREATER_THAN_OR_EQUAL_TO_THRESHOLD, "3", "CPUUtilization","AWS/EC2",
|
98
|
+
"60","Average","80", {:alarm_actions => [as_up_scaling_policy]})
|
99
|
+
as_down_alarm = CfCloudWatchAlarm.new("MyDownAlarm",CfCloudWatchAlarm::LESS_THAN_THRESHOLD, "3", "CPUUtilization","AWS/EC2",
|
100
|
+
"60","Average","30", {:alarm_actions => [as_down_scaling_policy]})
|
101
|
+
cf.add_resource(as_up_alarm)
|
102
|
+
cf.add_resource(as_down_alarm)
|
103
|
+
|
104
|
+
#cloudfront
|
105
|
+
# distribution with multiple origins, one for S3, one for the ELB
|
106
|
+
#define origins
|
107
|
+
elb_origin = CfOrigin.create_elb_origin(elb)
|
108
|
+
s3_origin = CfOrigin.create_s3_origin(s3_bucket)
|
109
|
+
origins = [elb_origin, s3_origin]
|
110
|
+
#define cache behaviors for origins
|
111
|
+
default_cache_behavior = CfDefaultCacheBehavior.create_basic(elb_origin.id)
|
112
|
+
cache_behaviors = [
|
113
|
+
CfCacheBehavior.create_basic(s3_origin.id, "/static/*", :min_ttl => 24*60*60),
|
114
|
+
CfCacheBehavior.create_basic(s3_origin.id, "*.jpg", :min_ttl => 24*60*60)
|
115
|
+
]
|
116
|
+
#tie everything together
|
117
|
+
cname_endpoint = "cached-elb-#{(Random.new.rand*100000).to_i}.dezidr.com"
|
118
|
+
logging = CfLogging.new(s3_log_bucket,"log-") #activate logging
|
119
|
+
cf_distribution = CfCloudfrontDistribution.create_multi_origin_distribution("MyDistribution", origins,
|
120
|
+
default_cache_behavior, cache_behaviors, {:logging => logging, :aliases => [cname_endpoint]})
|
121
|
+
cf.add_resource(cf_distribution)
|
122
|
+
|
123
|
+
#route53
|
124
|
+
cloudfront_dns = cf_distribution.retrieve_attribute("DomainName")
|
125
|
+
cname = CfRoute53RecordSet.new("CnameRecord", "#{cname_endpoint}", "CNAME", {:ttl => 1, :resource_records => [cloudfront_dns], :hosted_zone_id => hosted_zone_id})
|
126
|
+
cf.add_resource(cname)
|
127
|
+
elb_alias = CfRoute53RecordSet.new("ElbAliasRecord","elb-#{(Random.new.rand*100000).to_i}.#{hosted_zone_name}","A", {:alias_target => CfElbAliasTarget.new(elb), :hosted_zone_id => hosted_zone_id})
|
128
|
+
cf.add_resource(elb_alias)
|
129
|
+
|
130
|
+
####### output parameters
|
131
|
+
elb_output = CfOutput.new("ElbEndpoint","Endpoint of the ELB",elb.retrieve_attribute("DNSName"))
|
132
|
+
cf.add_output(elb_output)
|
133
|
+
cloudfront_domain = CfOutput.new("CloudfrontDomain", "Endpoint of the CloudFront distribution", cf_distribution.retrieve_attribute("DomainName"))
|
134
|
+
cf.add_output(cloudfront_domain)
|
135
|
+
|
136
|
+
cf_json = cf.generate
|
137
|
+
puts cf_json
|
138
|
+
|
139
|
+
config_options = YAML.load_file("aws_config.yml")
|
140
|
+
config_options["cloud_formation_endpoint"] = "cloudformation.us-east-1.amazonaws.com"
|
141
|
+
puts config_options.inspect
|
142
|
+
validator = TemplateValidation.new(cf_json, config_options)
|
143
|
+
validator.validate()
|
144
|
+
#validator.apply({"AppServerAmi" => ami_id, "AppServerKey" => "majung", "AppPort" => "80", "MasterUserName" => "iamauser", "MasterPassword" => "abcd1234"})
|
145
|
+
|
146
|
+
#puts "the reference for the VPC : #{vpc.generate_ref}"
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'help/include_libraries'
|
2
|
+
|
3
|
+
# CloudFormation template for Atraveo. 2-Tiered web-application with load-balancing.
|
4
|
+
cf = CfMain.new("S3 Bucket with CloudFront distribution")
|
5
|
+
|
6
|
+
####### input parameters
|
7
|
+
|
8
|
+
####### mappings
|
9
|
+
|
10
|
+
####### resources
|
11
|
+
|
12
|
+
s3_bucket = CfS3Bucket.new("OriginBucket")
|
13
|
+
cf.add_resource(s3_bucket)
|
14
|
+
s3_log_bucket = CfS3Bucket.new("LogBucket")
|
15
|
+
|
16
|
+
#cloudfront
|
17
|
+
logging = CfLogging.new(s3_bucket,"MyDistribution")
|
18
|
+
options = {:logging => logging}
|
19
|
+
cloudfront_distribution = CfCloudfrontDistribution.create_s3_distribution("MyS3Distribution",s3_bucket)
|
20
|
+
cf.add_resource(cloudfront_distribution)
|
21
|
+
|
22
|
+
####### output parameters
|
23
|
+
s3_domain = CfOutput.new("S3Domain","Domain name of S3 bucket",s3_bucket.retrieve_attribute("DomainName"))
|
24
|
+
cf.add_output(s3_domain)
|
25
|
+
cloudfront_domain = CfOutput.new("CloudfrontDomain", "Endpoint of the CloudFront distribution", cloudfront_distribution.retrieve_attribute("DomainName"))
|
26
|
+
cf.add_output(cloudfront_domain)
|
27
|
+
|
28
|
+
cf_json = cf.generate
|
29
|
+
puts cf_json
|
30
|
+
|
31
|
+
config_options = YAML.load_file("aws_config.yml")
|
32
|
+
validator = TemplateValidation.new(cf_json, config_options)
|
33
|
+
validator.validate()
|
34
|
+
validator.apply()
|
35
|
+
|
36
|
+
#puts "the reference for the VPC : #{vpc.generate_ref}"
|