Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

CloudFormation vs. Elastic Beanstalk & Use cases

770 views

Published on

Session talk deck for MasterCloud #3
http://mastercloud.jp

Published in: Engineering
  • Be the first to comment

  • Be the first to like this

CloudFormation vs. Elastic Beanstalk & Use cases

  1. 1. MasterCloud CloudFormation vs. ElasticBeanstalk & Use cases MasterCloud #3 (2017/07/12)
  2. 2. MasterCloud Speaker Introduction Wayland Zhang (張卓) CEO, Founder @ Mobingi, Inc. 10 years programmer 2015年から日本在住 ★★★✩✩✩✩✩✩✩ www.facebook.com/waylandzhang www.twitter.com/waylandzhang www.instagram.com/wayland
  3. 3. MasterCloud 日本語は、居酒屋語だけ! 生ふたず 枝豆 鶏皮 塩でHighball とりあえず!
  4. 4. Mobingi, Inc. • ALM (Application Lifecycle Management) • Docker Container Integrated (Docker knowledge not required) • Open source around 2017 September Partner Partner
  5. 5. MasterCloud CloudFormation
  6. 6. MasterCloud -Deployed more than 1,000 stacks -Started to use CloudFormation since 2012 -Limit: 20 stacks per region per account -Up to 1 hr to deploy a complicated stack Personally, I
  7. 7. MasterCloud CloudFormation Template base (Json /Yaml)
  8. 8. MasterCloud CloudFormation Visual Designer
  9. 9. MasterCloud AWS IaaS Layer CloudFormation Storage, Compute, Networking Application Services CloudFormation
  10. 10. MasterCloud { "AWSTemplateFormatVersion" : “2010-09-09", "Parameters" : { "KeyName": { "Type": "AWS::EC2::KeyPair::KeyName", }, "InstanceType" : { "Type" : "String", "Default" : "t2.small" } }, "Resources" : { "EC2Instance" : { "Type" : "AWS::EC2::Instance", "Properties" : { "InstanceType" : { "Ref" : "InstanceType" }, "ImageId" : { "Fn::FindInMap" : [ "AWSRegionArch2AMI", { "Ref" : "AWS::Region" }, { "Fn::FindInMap" : [ "AWSInstanceType2Arch", { "Ref" : "InstanceType" }, "Arch" ] } ] }, "SecurityGroups" : [{ "Ref" : "EC2SecurityGroup" }], "BlockDeviceMappings" : [ { "DeviceName" : "/dev/sdc", "VirtualName" : "ephemeral0" } ] } }, "EC2SecurityGroup" : { "Type" : "AWS::EC2::SecurityGroup", "Properties" : { "GroupDescription" : "SSH access", "SecurityGroupIngress" : [{ "IpProtocol" : "tcp", "FromPort" : "22", "ToPort" : "22", "CidrIp" : { "Ref" : "SSHLocation" }}] } } }, "Outputs" : { "Instance" : { "Value" : { "Fn::GetAtt" : [ "EC2Instance", "PublicDnsName" ] }, "Description" : "DNS Name of the newly created EC2 instance" } } …
  11. 11. MasterCloud { "AWSTemplateFormatVersion" : “2010-09-09", "Parameters" : { "KeyName": { "Type": "AWS::EC2::KeyPair::KeyName", }, "InstanceType" : { "Type" : "String", "Default" : "t2.small" } }, "Resources" : { "EC2Instance" : { "Type" : "AWS::EC2::Instance", "Properties" : { "InstanceType" : { "Ref" : "InstanceType" }, "ImageId" : { "Fn::FindInMap" : [ "AWSRegionArch2AMI", { "Ref" : "AWS::Region" }, { "Fn::FindInMap" : [ "AWSInstanceType2Arch", { "Ref" : "InstanceType" }, "Arch" ] } ] }, "SecurityGroups" : [{ "Ref" : "EC2SecurityGroup" }], "BlockDeviceMappings" : [ { "DeviceName" : "/dev/sdc", "VirtualName" : "ephemeral0" } ] } }, "EC2SecurityGroup" : { "Type" : "AWS::EC2::SecurityGroup", "Properties" : { "GroupDescription" : "SSH access", "SecurityGroupIngress" : [{ "IpProtocol" : "tcp", "FromPort" : "22", "ToPort" : "22", "CidrIp" : { "Ref" : "SSHLocation" }}] } } }, "Outputs" : { "Instance" : { "Value" : { "Fn::GetAtt" : [ "EC2Instance", "PublicDnsName" ] }, "Description" : "DNS Name of the newly created EC2 instance" } } … Customized Name
  12. 12. MasterCloud { "AWSTemplateFormatVersion" : “2010-09-09", "Parameters" : { "KeyName": { "Type": "AWS::EC2::KeyPair::KeyName", }, "InstanceType" : { "Type" : "String", "Default" : "t2.small" } }, "Resources" : { "EC2Instance" : { "Type" : "AWS::EC2::Instance", "Properties" : { "InstanceType" : { "Ref" : "InstanceType" }, "ImageId" : { "Fn::FindInMap" : [ "AWSRegionArch2AMI", { "Ref" : "AWS::Region" }, { "Fn::FindInMap" : [ "AWSInstanceType2Arch", { "Ref" : "InstanceType" }, "Arch" ] } ] }, "SecurityGroups" : [{ "Ref" : "EC2SecurityGroup" }], "BlockDeviceMappings" : [ { "DeviceName" : "/dev/sdc", "VirtualName" : "ephemeral0" } ] } }, "EC2SecurityGroup" : { "Type" : "AWS::EC2::SecurityGroup", "Properties" : { "GroupDescription" : "SSH access", "SecurityGroupIngress" : [{ "IpProtocol" : "tcp", "FromPort" : "22", "ToPort" : "22", "CidrIp" : { "Ref" : "SSHLocation" }}] } } }, "Outputs" : { "Instance" : { "Value" : { "Fn::GetAtt" : [ "EC2Instance", "PublicDnsName" ] }, "Description" : "DNS Name of the newly created EC2 instance" } } … Used in reference
  13. 13. MasterCloud { "AWSTemplateFormatVersion" : “2010-09-09", "Parameters" : { "KeyName": { "Type": "AWS::EC2::KeyPair::KeyName", }, "InstanceType" : { "Type" : "String", "Default" : "t2.small" } }, "Resources" : { "EC2Instance" : { "Type" : "AWS::EC2::Instance", "Properties" : { "InstanceType" : { "Ref" : "InstanceType" }, "ImageId" : { "Fn::FindInMap" : [ "AWSRegionArch2AMI", { "Ref" : "AWS::Region" }, { "Fn::FindInMap" : [ "AWSInstanceType2Arch", { "Ref" : "InstanceType" }, "Arch" ] } ] }, "SecurityGroups" : [{ "Ref" : "EC2SecurityGroup" }], "BlockDeviceMappings" : [ { "DeviceName" : "/dev/sdc", "VirtualName" : "ephemeral0" } ] } }, "EC2SecurityGroup" : { "Type" : "AWS::EC2::SecurityGroup", "Properties" : { "GroupDescription" : "SSH access", "SecurityGroupIngress" : [{ "IpProtocol" : "tcp", "FromPort" : "22", "ToPort" : "22", "CidrIp" : { "Ref" : "SSHLocation" }}] } } }, "Outputs" : { "Instance" : { "Value" : { "Fn::GetAtt" : [ "EC2Instance", "PublicDnsName" ] }, "Description" : "DNS Name of the newly created EC2 instance" } } … AWS Resource Type
  14. 14. MasterCloud { "AWSTemplateFormatVersion" : “2010-09-09", "Parameters" : { "KeyName": { "Type": "AWS::EC2::KeyPair::KeyName", }, "InstanceType" : { "Type" : "String", "Default" : "t2.small" } }, "Resources" : { "EC2Instance" : { "Type" : "AWS::EC2::Instance", "Properties" : { "InstanceType" : { "Ref" : "InstanceType" }, "ImageId" : { "Fn::FindInMap" : [ "AWSRegionArch2AMI", { "Ref" : "AWS::Region" }, { "Fn::FindInMap" : [ "AWSInstanceType2Arch", { "Ref" : "InstanceType" }, "Arch" ] } ] }, "SecurityGroups" : [{ "Ref" : "EC2SecurityGroup" }], "BlockDeviceMappings" : [ { "DeviceName" : "/dev/sdc", "VirtualName" : "ephemeral0" } ] } }, "EC2SecurityGroup" : { "Type" : "AWS::EC2::SecurityGroup", "Properties" : { "GroupDescription" : "SSH access", "SecurityGroupIngress" : [{ "IpProtocol" : "tcp", "FromPort" : "22", "ToPort" : "22", "CidrIp" : { "Ref" : "SSHLocation" }}] } } }, "Outputs" : { "Instance" : { "Value" : { "Fn::GetAtt" : [ "EC2Instance", "PublicDnsName" ] }, "Description" : "DNS Name of the newly created EC2 instance" } } … Documentation: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html
  15. 15. MasterCloud { "AWSTemplateFormatVersion" : “2010-09-09", "Parameters" : { "KeyName": { "Type": "AWS::EC2::KeyPair::KeyName", }, "InstanceType" : { "Type" : "String", "Default" : "t2.small" } }, "Resources" : { "EC2Instance" : { "Type" : "AWS::EC2::Instance", "Properties" : { "InstanceType" : { "Ref" : "InstanceType" }, "ImageId" : { "Fn::FindInMap" : [ "AWSRegionArch2AMI", { "Ref" : "AWS::Region" }, { "Fn::FindInMap" : [ "AWSInstanceType2Arch", { "Ref" : "InstanceType" }, "Arch" ] } ] }, "SecurityGroups" : [{ "Ref" : "EC2SecurityGroup" }], "BlockDeviceMappings" : [ { "DeviceName" : "/dev/sdc", "VirtualName" : "ephemeral0" } ] } }, "EC2SecurityGroup" : { "Type" : "AWS::EC2::SecurityGroup", "Properties" : { "GroupDescription" : "SSH access", "SecurityGroupIngress" : [{ "IpProtocol" : "tcp", "FromPort" : "22", "ToPort" : "22", "CidrIp" : { "Ref" : "SSHLocation" }}] } } }, "Outputs" : { "Instance" : { "Value" : { "Fn::GetAtt" : [ "EC2Instance", "PublicDnsName" ] }, "Description" : "DNS Name of the newly created EC2 instance" } } … ec2-54-250-104-129.ap-northeast-1.compute.amazonaws.com
  16. 16. MasterCloud AWSTemplateFormatVersion: “2010-09-09“ Description: String Metadata: template metadata Parameters: set of parameters Mappings: set of mappings Conditions: set of conditions Transform: set of transforms Resources: set of resources Outputs: set of outputs • Fn::And
 • Fn::Equals
 • Fn::If
 • Fn::Not
 • Fn::Or
 Condition Intrinsic Functions
  17. 17. MasterCloud Elastic Beanstalk
  18. 18. MasterCloud ElasticBeanstalk
  19. 19. MasterCloud AWS IaaS Layer CloudFormation Storage, Compute, Networking Application Services CloudFormation
  20. 20. MasterCloud ElasticBeanstalk AWS IaaS Layer CloudFormation Storage, Compute, Networking Application ServicesElasticBeanstalk
  21. 21. MasterCloud UI based configuration
  22. 22. MasterCloud Monitoring
  23. 23. MasterCloud Activities
  24. 24. MasterCloud Logs
  25. 25. MasterCloud UI S3 EC2 Servers Code Deploy $ eb deploy .. CLI
  26. 26. MasterCloud CloudFormation ElasticBeanstalk Interface Code (Cli) UI
 (Cli) Application Environment No (EC2 AMI level only) Yes
 (php, python, NodeJS, etc..) Layer Resource Provisioning Application Stack Deployment Target Low-level
 (system engineer) High-level
 (developers) Difficulty ✡✡✡✡✡ ✡
  27. 27. MasterCloud Other Cloud Providers? - Resource Manager template (CF) - App Service (≈EB) & others ALM - Cloud Deployment Manager (CF) - App Engine (≈EB) = CF ≈ Orchestrator = CF + EB
  28. 28. MasterCloud Use cases
  29. 29. MasterCloud Use case 1 : A LAMP Application -Lightening fast -General configuration -In frequent update
  30. 30. MasterCloud Use case 2: A multi-AZ, Load-balanced stack with extra security layer You require: - VPC, customized gateway ACL, - public subnet for EC2, private subnet for Multi-AZ RDS - Security group (port 443,80,22,ping) - 3 AZ for web EC2 high availability - With customized SSL certificate - …
  31. 31. MasterCloud “Infrastructure as Code.”
  32. 32. MasterCloud Infra Provision >> Configuration >> Deploy & Run >> Monitor & Secure >> “Infrastructure as Code.” Networking Storage Compute VM OS Softwares Package Environment Git Logging Secret management Audit Secure Access “Application Automation” “Application Lifecycle Management” Scaling CD/CI
  33. 33. MasterCloud Usage case 4 (SBCloud): Application Stack with Mobingi ALM ALM template snippet: { "vendor": { "alicloud": { "cred": "*********2DZLA", "secret": "****************DTo5", "region": "ap-northeast-1" } }, "configurations": [ { "role": "web", "flag": "pokemon_web", "provision": { "instance_type": "xn1.small", "count": 2, "storage": { "type": "ebs", "size": 30, "volume_type": "${computed}" } }, "container": { "updated": "${computed}", "image": "registry.mobingi.com/mobingi/ubuntu-apache2-php5", "gitRepo": "https://github.com/sample/pokemon_web.git", "gitReference": "master", "gitPrivateKey": "-----BEGIN PRIVATE ...n-----END PRIVATE KEY-----n", "environmentVariables": { "my_hash": "D3nz!lwA$h1ngt0n" } } } } Releasing August, 2017 Infra Provision >> Configuration >> Deploy & Run >> Monitor & Secure >>
  34. 34. MasterCloud http://slack.mobingi.com

×