Skip to content

Instantly share code, notes, and snippets.

Created February 3, 2016 18:25
Show Gist options
  • Save anonymous/84dfc7f2199ad39622e9 to your computer and use it in GitHub Desktop.
Save anonymous/84dfc7f2199ad39622e9 to your computer and use it in GitHub Desktop.
XtreemFS CloudFormation template (read-only replication because WqRq and WaR1 were not working)
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "XtreemFS CloudFormation template.",
"Parameters" : {
"DataNodeCount" : {
"Description" : "Number of data nodes to provision in cluster (2-18)",
"Type" : "Number",
"Default" : "2",
"MinValue" : "2",
"MaxValue" : "18",
"ConstraintDescription" : "must be between 2 and 18."
},
"KeyPair": {
"Description" : "Name of an existing EC2 KeyPair: https://console.aws.amazon.com/ec2/v2/home#KeyPairs:",
"Type": "String",
"MinLength": "1",
"MaxLength": "255",
"AllowedPattern" : "[\\x20-\\x7E]*",
"ConstraintDescription" : "can contain only ASCII characters."
},
"ClusterAccess" : {
"Description" : "CIDR IP range allowed to login to the cluster instances",
"Type": "String",
"MinLength": "9",
"MaxLength": "18",
"Default": "0.0.0.0/0",
"AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
"ConstraintDescription": "must be a valid IP CIDR range of the form x.x.x.x/x."
},
"ClusterInstanceType" : {
"Description" : "AMI instance type: https://aws.amazon.com/ec2/instance-types/",
"Type" : "String",
"Default" : "m1.medium"
}
},
"Mappings" : {
"LinuxRegionMap" : {
"us-east-1" : { "AMI" : "ami-6aeac800" },
"us-west-2" : { "AMI" : "ami-86f512e6" },
"us-west-1" : { "AMI" : "ami-b3a7d0d3" },
"eu-west-1" : { "AMI" : "ami-89fc4bfa" },
"eu-central-1" : { "AMI" : "ami-24637b48" },
"ap-southeast-1" : { "AMI" : "ami-15fe3176" },
"ap-southeast-2" : { "AMI" : "ami-6b072308" },
"ap-northeast-1" : { "AMI" : "ami-991d25f7" },
"sa-east-1" : { "AMI" : "ami-88b434e4" }
}
},
"Resources" : {
"ClusterSecurityGroup" : {
"Type" : "AWS::EC2::SecurityGroup",
"Properties" : {
"GroupDescription" : "Cluster Security Group",
"Tags" : [{ "Key" : "Name", "Value" : "Cluster Security Group" }],
"SecurityGroupIngress" : [
{
"IpProtocol" : "tcp",
"FromPort" : "22",
"ToPort" : "22",
"CidrIp" : { "Ref" : "ClusterAccess" }
},
{
"IpProtocol" : "tcp",
"FromPort" : "30636",
"ToPort" : "30636",
"CidrIp" : { "Ref" : "ClusterAccess" }
},
{
"IpProtocol" : "tcp",
"FromPort" : "30638",
"ToPort" : "30638",
"CidrIp" : { "Ref" : "ClusterAccess" }
},
{
"IpProtocol" : "tcp",
"FromPort" : "30640",
"ToPort" : "30640",
"CidrIp" : { "Ref" : "ClusterAccess" }
}
]
}
},
"UpdateSecurityGroup" : {
"Type" : "AWS::EC2::SecurityGroupIngress",
"Properties" : {
"GroupName" : { "Ref" : "ClusterSecurityGroup" },
"SourceSecurityGroupName" : { "Ref" : "ClusterSecurityGroup" },
"IpProtocol" : "tcp",
"FromPort" : "0",
"ToPort" : "65535"
}
},
"Master1" : {
"Type" : "AWS::EC2::Instance",
"Properties" : {
"InstanceType" : { "Ref" : "ClusterInstanceType" },
"SecurityGroups" : [ { "Ref" : "ClusterSecurityGroup" } ],
"KeyName" : { "Ref" : "KeyPair" },
"ImageId" : { "Fn::FindInMap" : [ "LinuxRegionMap", { "Ref" : "AWS::Region" }, "AMI" ]},
"Tags" : [{ "Key" : "Name", "Value" : "XtreemFS Server" }],
"UserData" : { "Fn::Base64" : { "Fn::Join" : ["", [
"#!/bin/bash\n",
"sudo su -\n",
"echo 'deb http://download.opensuse.org/repositories/home:/xtreemfs/xUbuntu_14.04 ./' >> /etc/apt/sources.list\n",
"wget -q http://download.opensuse.org/repositories/home:/xtreemfs/xUbuntu_14.04/Release.key -O - | sudo apt-key add -\n",
"apt-get update -y && apt-get install -y xtreemfs-server\n",
"mkdir -p /mnt/xfsobjs\n",
"sed -i \"s/localhost/`curl -s http://169.254.169.254/latest/meta-data/local-ipv4`/\" /etc/xos/xtreemfs/mrcconfig.properties\n",
"echo \"hostname = `curl -s http://169.254.169.254/latest/meta-data/local-ipv4`\" >> /etc/xos/xtreemfs/mrcconfig.properties\n",
"sed -i \"s/localhost/`curl -s http://169.254.169.254/latest/meta-data/local-ipv4`/\" /etc/xos/xtreemfs/osdconfig.properties\n",
"sed -i \"s/\\/var\\/lib\\/xtreemfs\\/objs\\//\\/mnt\\/xfsobjs\\//\" /etc/xos/xtreemfs/osdconfig.properties\n",
"echo \"hostname = `curl -s http://169.254.169.254/latest/meta-data/local-ipv4`\" >> /etc/xos/xtreemfs/osdconfig.properties\n",
"chmod 777 /mnt/xfsobjs\n",
"/etc/init.d/xtreemfs-dir start\n",
"sleep 5 && /etc/init.d/xtreemfs-mrc start\n",
"sleep 5 && /etc/init.d/xtreemfs-osd start"
]]}}
}
},
"Master2" : {
"Type" : "AWS::EC2::Instance",
"DependsOn" : "Master1",
"Properties" : {
"InstanceType" : { "Ref" : "ClusterInstanceType" },
"SecurityGroups" : [ { "Ref" : "ClusterSecurityGroup" } ],
"KeyName" : { "Ref" : "KeyPair" },
"ImageId" : { "Fn::FindInMap" : [ "LinuxRegionMap", { "Ref" : "AWS::Region" }, "AMI" ]},
"Tags" : [{ "Key" : "Name", "Value" : "XtreemFS Server" }],
"UserData" : { "Fn::Base64" : { "Fn::Join" : ["", [
"#!/bin/bash\n",
"sudo su -\n",
"echo 'deb http://download.opensuse.org/repositories/home:/xtreemfs/xUbuntu_14.04 ./' >> /etc/apt/sources.list\n",
"wget -q http://download.opensuse.org/repositories/home:/xtreemfs/xUbuntu_14.04/Release.key -O - | sudo apt-key add -\n",
"apt-get update -y && apt-get install -y xtreemfs-server\n",
"mkdir -p /mnt/xfsobjs\n",
"sed -i \"s/localhost/`curl -s http://169.254.169.254/latest/meta-data/local-ipv4`/\" /etc/xos/xtreemfs/mrcconfig.properties\n",
"echo \"hostname = `curl -s http://169.254.169.254/latest/meta-data/local-ipv4`\" >> /etc/xos/xtreemfs/mrcconfig.properties\n",
"sed -i \"s/localhost/`curl -s http://169.254.169.254/latest/meta-data/local-ipv4`/\" /etc/xos/xtreemfs/osdconfig.properties\n",
"sed -i \"s/\\/var\\/lib\\/xtreemfs\\/objs\\//\\/mnt\\/xfsobjs\\//\" /etc/xos/xtreemfs/osdconfig.properties\n",
"echo \"hostname = `curl -s http://169.254.169.254/latest/meta-data/local-ipv4`\" >> /etc/xos/xtreemfs/osdconfig.properties\n",
"echo 'dir_service1.host = ",
{ "Fn::GetAtt" : [ "Master1" , "PrivateIp" ] },
"' >> /etc/xos/xtreemfs/mrcconfig.properties\n",
"echo 'dir_service1.port = 32638' >> /etc/xos/xtreemfs/mrcconfig.properties\n",
"echo 'dir_service1.host = ",
{ "Fn::GetAtt" : [ "Master1" , "PrivateIp" ] },
"' >> /etc/xos/xtreemfs/osdconfig.properties\n",
"echo 'dir_service1.port = 32638' >> /etc/xos/xtreemfs/osdconfig.properties\n",
"chmod 777 /mnt/xfsobjs\n",
"/etc/init.d/xtreemfs-dir start\n",
"sleep 5 && /etc/init.d/xtreemfs-mrc start\n",
"sleep 5 && /etc/init.d/xtreemfs-osd start"
]]}}
}
},
"Master3" : {
"Type" : "AWS::EC2::Instance",
"DependsOn" : "Master2",
"Properties" : {
"InstanceType" : { "Ref" : "ClusterInstanceType" },
"SecurityGroups" : [ { "Ref" : "ClusterSecurityGroup" } ],
"KeyName" : { "Ref" : "KeyPair" },
"ImageId" : { "Fn::FindInMap" : [ "LinuxRegionMap", { "Ref" : "AWS::Region" }, "AMI" ]},
"Tags" : [{ "Key" : "Name", "Value" : "XtreemFS Server" }],
"UserData" : { "Fn::Base64" : { "Fn::Join" : ["", [
"#!/bin/bash\n",
"sudo su -\n",
"echo 'deb http://download.opensuse.org/repositories/home:/xtreemfs/xUbuntu_14.04 ./' >> /etc/apt/sources.list\n",
"wget -q http://download.opensuse.org/repositories/home:/xtreemfs/xUbuntu_14.04/Release.key -O - | sudo apt-key add -\n",
"apt-get update -y && apt-get install -y xtreemfs-server\n",
"mkdir -p /mnt/xfsobjs\n",
"sed -i \"s/localhost/`curl -s http://169.254.169.254/latest/meta-data/local-ipv4`/\" /etc/xos/xtreemfs/mrcconfig.properties\n",
"echo \"hostname = `curl -s http://169.254.169.254/latest/meta-data/local-ipv4`\" >> /etc/xos/xtreemfs/mrcconfig.properties\n",
"sed -i \"s/localhost/`curl -s http://169.254.169.254/latest/meta-data/local-ipv4`/\" /etc/xos/xtreemfs/osdconfig.properties\n",
"sed -i \"s/\\/var\\/lib\\/xtreemfs\\/objs\\//\\/mnt\\/xfsobjs\\//\" /etc/xos/xtreemfs/osdconfig.properties\n",
"echo \"hostname = `curl -s http://169.254.169.254/latest/meta-data/local-ipv4`\" >> /etc/xos/xtreemfs/osdconfig.properties\n",
"echo 'dir_service1.host = ",
{ "Fn::GetAtt" : [ "Master1" , "PrivateIp" ] },
"' >> /etc/xos/xtreemfs/mrcconfig.properties\n",
"echo 'dir_service1.port = 32638' >> /etc/xos/xtreemfs/mrcconfig.properties\n",
"echo 'dir_service1.host = ",
{ "Fn::GetAtt" : [ "Master1" , "PrivateIp" ] },
"' >> /etc/xos/xtreemfs/osdconfig.properties\n",
"echo 'dir_service1.port = 32638' >> /etc/xos/xtreemfs/osdconfig.properties\n",
"chmod 777 /mnt/xfsobjs\n",
"/etc/init.d/xtreemfs-dir start\n",
"sleep 5 && /etc/init.d/xtreemfs-mrc start\n",
"sleep 5 && /etc/init.d/xtreemfs-osd start"
]]}}
}
},
"DataNode" : {
"Type" : "AWS::AutoScaling::LaunchConfiguration",
"DependsOn" : "Master3",
"Properties" : {
"InstanceType" : { "Ref" : "ClusterInstanceType" },
"SecurityGroups" : [ { "Ref" : "ClusterSecurityGroup" } ],
"KeyName" : { "Ref" : "KeyPair" },
"ImageId" : { "Fn::FindInMap" : [ "LinuxRegionMap", { "Ref" : "AWS::Region" }, "AMI" ]},
"UserData" : { "Fn::Base64" : { "Fn::Join" : ["", [
"#!/bin/bash\n",
"sudo su -\n",
"echo 'deb http://download.opensuse.org/repositories/home:/xtreemfs/xUbuntu_14.04 ./' >> /etc/apt/sources.list\n",
"wget -q http://download.opensuse.org/repositories/home:/xtreemfs/xUbuntu_14.04/Release.key -O - | sudo apt-key add -\n",
"apt-get update -y && apt-get install -y xtreemfs-client xtreemfs-tools\n",
"sleep 5 && modprobe fuse\n",
"sleep 120 && mkfs.xtreemfs ",
{ "Fn::GetAtt" : [ "Master2" , "PrivateIp" ] },
"/myVolume\n",
"mkdir -p /mnt/xtreemfs\n",
"mount.xtreemfs ",
{ "Fn::GetAtt" : [ "Master2" , "PrivateIp" ] },
"/myVolume /mnt/xtreemfs\n",
"xtfsutil --set-drp --replication-policy ronly --replication-factor 2 /mnt/xtreemfs"
]]}}
}
},
"ClusterInit" : {
"Type" : "AWS::AutoScaling::AutoScalingGroup",
"Properties" : {
"AvailabilityZones" : { "Fn::GetAZs" : "" },
"LaunchConfigurationName" : { "Ref" : "DataNode" },
"MinSize" : "2",
"MaxSize" : "18",
"DesiredCapacity" : { "Ref" : "DataNodeCount" },
"Tags" : [{ "Key" : "Name", "Value" : "XtreemFS Node", "PropagateAtLaunch" : "true" }]
}
}
},
"Outputs" : {
"Info" : {
"Description" : "Info",
"Value" : "Wait 5 minutes for the system to initialize. Then, any file created on the 'XtreemFS Node' instances in /mnt/xtreemfs will be synced to all XtreemFS Node instances."
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment