SlideShare a Scribd company logo
Managing Microservices
using Terraform, Docker, and the Cloud
Given by Derek C. Ashmore
JavaOne – Oct 2, 2017
©2017 Derek C. Ashmore, All Rights Reserved 1
Who am I?
• Professional Geek
since 1987
• Java/J2EE/Java EE
since 1999
• AWS since 2010
• Specialties
• Refactoring
• Performance
Tuning
• Yes – I still code!
©2017 Derek C. Ashmore, All Rights Reserved 2
Lab Preparation
• This lab has set-up instructions on my github
– https://github.com/Derek-Ashmore/terraform-hands-on-lab
• Set up for the lab during the discussion!
– It is socially acceptable
– I will not wait for you to do the setup!
– Feel free to treat the lab as a demo
©2017 Derek C. Ashmore, All Rights Reserved 3
Discussion Resources
• This slide deck
– http://www.slideshare.net/derekashmore
• The hands-on-lab code and setup instructions
– https://github.com/Derek-Ashmore/terraform-hands-on-lab
• The Moneta microservice (written in Java)
– https://github.com/Derek-Ashmore/moneta
• Slide deck has hyper-links!
– Don’t bother writing down URLs
©2017 Derek C. Ashmore, All Rights Reserved 4
Agenda
Microservices,
Docker, and
the Cloud
Cloud with
Terraform
Terraform’s
Competitors
Summary /
Q&A
Hands-On
Lab/Demo
©2017 Derek C. Ashmore, All Rights Reserved 5
What are Microservices?
• No concrete definition
• Common microservice traits
– Single functional purpose
• Most/all changes only impact one service
• Not dependent on execution context
– “loosely coupled”
– Independent process/jvm
– Stateless
– Standard Interface (typically Web Service/REST)
– Analogy: Stereo system, Linux utilities
©2017 Derek C. Ashmore, All Rights Reserved 6
Microservices Application Architecture
• Separate Databases
• Eventual Consistency
• More network activity
©2017 Derek C. Ashmore, All Rights Reserved 7
Typical Microservice Library
©2017 Derek C. Ashmore, All Rights Reserved 8
Microservice Deployments
©2017 Derek C. Ashmore, All Rights Reserved 9
Docker
• Is a “mini VM”
• runs a linux kernal
• Compare to shipping
container
• Standard “connections” to
outside world
• Supported formally by
Oracle, Tomcat, Jboss, and
many more
10©2017 Derek C. Ashmore, All Rights Reserved
Package Once, Run Anywhere!
Why Docker?
• Docker is Win-Win
– Easier for OPS and system administrators
• All software looks the same
• Standard interface for disk and network resources
– Containers can be “linked”
• Inherently automated
– Easier for developers
• Fewer environment difference issues
• Less to communicate to OPS / system administrators
• Easy to leverage work of others (docker-hub)
– If you haven’t tried Docker yet – you should!
©2017 Derek C. Ashmore, All Rights Reserved 11
Docker Build File
• Docker file for Microservice Moneta
– Base Image
• FROM java:8-jre
– Expose Folder
• VOLUME /config
– Download Moneta Jar Release
• RUN curl -SL "$MONETA_URL" -o moneta-dropwizard.jar
– Expose Ports
• EXPOSE 8080 8081
– Run It
• ENTRYPOINT exec java -classpath $CLASSPATH -server $JAVA_OPTS
• -jar moneta-dropwizard.jar server /config/moneta-dropwizard.yaml
©2017 Derek C. Ashmore, All Rights Reserved 12
Running a Docker Image
• The Docker Run Command
– Exposes Ports
– Attaches Disk
– Passes/sets Environment Variables
– Allocates Memory
• Example from the Lab Portion
– export JAVA_OPTS="-Xmx768m”
– docker pull derekashmore/moneta-dropwizard:0.9.3-alpha
– docker run -d -p 80:8080 -m 800m -e JAVA_OPTS
– -v $PWD/moneta-config:/config derekashmore/moneta-dropwizard:0.9.3-alpha
©2017 Derek C. Ashmore, All Rights Reserved 13
Typical Microservice Install at AWS
©2017 Derek C. Ashmore, All Rights Reserved 14
• Horizontal scaling is supported
• Multiple copies of microservice / web application
running at the same time
• Elastic Load Balancer distributes load across
copies of your service
• Sticky sessions available
• ELB can use health checks
• Autoscaling Groups scale number of copies up
and down based on rules you give it
• CPU Utilization or other metrics
• Autoscaling Groups distribute across availability
zones for availability
Network Security
©2017 Derek C. Ashmore, All Rights Reserved 15
Network Security (con’t)
• Public vs. Private subnets
– Specified by Routes and Network ACLs
– Public subnets can be used from the internet
• Web Servers typically placed here
– Private subnets only used within your Virtual Network
• Access from the internet just not possible
– Even if a public IP is assigned
• Microservices
• Databases
• Messaging traffic
• It’s common to add SSO (for web applications) and OAUTH (for
microservices) above that
©2017 Derek C. Ashmore, All Rights Reserved 16
Security Groups
• Security Groups provide Inbound/Outbound rules for individual instances
– Think of as “an assignable firewall”
– Multiple rules per VM allowed.
– Easy additional layer of security
– No changes to applications or services needed.
• Examples
– Web Servers  Allow port 80 and 443 from anywhere
– Web Servers  Allow SSH/SFTP only from within the VPC
• Security Groups and be associated
– Financial Microservice Allow port 443 only from VMs belonging to security group
FINANCIAL_SERVICE_CLIENT_SG
– Oracle Database  Allow port 1521 only from VMs belonging to security group
ORACLE_CLIENT_SG
©2017 Derek C. Ashmore, All Rights Reserved 17
Managing Cloud Assets
• Objectives
– Managing Complexity
• Environment Consistency
• Environment Lifecycle Support
• Ease of change
• Reuse
– Manage risk of change
– Mitigate Cloud Lock-in
• Infrastructure as Code
– Reusable Infrastructure Components
• Leverage work/expertise of others
• Big problem  Smaller manageable problems
– Change Tracking – Source Control
©2017 Derek C. Ashmore, All Rights Reserved 18
Agenda
Microservices,
Docker, and
the Cloud
Cloud with
Terraform
Terraform’s
Competitors
Summary /
Q&A
Hands-On
Lab/Demo
©2017 Derek C. Ashmore, All Rights Reserved 19
Terraform
• Cloud Management
– Open Source
• Very active community
– Extensible to any cloud vendor
• AWS, Azure, GCP, AliCloud, Digital Ocean, OpenStack
– Supported for Cloud Support products
• Chef, Consul, Kubernetes, Datadog
• 62 Providers as of April, 2017 and growing
©2017 Derek C. Ashmore, All Rights Reserved 20
Terraform HCL
• Declarative Language
– Describe what the end product contains
• Terraform figures out how to get there
– Terraform Resources
• Describes deployed artifacts
– Network  Virtual Networks, Subnets, Network ACLs, Gateways, ELB/ALB
– Hosts  Virtual Machines, Databases
– Security  Security groups/policies/roles/groups/users
– Much more
©2017 Derek C. Ashmore, All Rights Reserved 21
Terraform Basics
• Declarative Programming
– All *.tf files loaded  Terraform decides execution order
– No GUI  All command line and text editor
• Top Commands
– Terraform plan  Describes planned changes
– Terraform apply  Makes planned changes
– Terraform taint  Forces re-creation of a resource
– Terraform destroy  deletes all resources
©2017 Derek C. Ashmore, All Rights Reserved 22
Terraform Resources
• AWS Subnet Resource
– Count = 3  Three subnets created
– Availability Zones come from a data source (lookup)
– CIDR blocks are input variables
• Sample source
©2017 Derek C. Ashmore, All Rights Reserved 23
Terraform Data Sources
• Example Data Sources (lookups)
• Sample source
©2017 Derek C. Ashmore, All Rights Reserved 24
Terraform Providers
• Example Provider
• Sample AWS source
• Azure Provider
©2017 Derek C. Ashmore, All Rights Reserved 25
Terraform Input Variables
• Example Provider
• Sample source
©2017 Derek C. Ashmore, All Rights Reserved 26
Reusing Terraform Templates
• Example Template Reuse
• Sample source
©2017 Derek C. Ashmore, All Rights Reserved 27
Typical Project Structure
©2017 Derek C. Ashmore, All Rights Reserved 28
Terraform State
• Terraform stores state
– Local file terraform.tfstate
• Teams need to manage state centrally
– Terraform Backends
• Locks so that only one person at a time can update
• Remote storage
– S3, Azure containers, Google cloud storage, etc.
©2017 Derek C. Ashmore, All Rights Reserved 29
Agenda
Microservices,
Docker, and
the Cloud
Cloud with
Terraform
Terraform’s
Competitors
Summary /
Q&A
Hands-On
Lab/Demo
©2017 Derek C. Ashmore, All Rights Reserved 30
Terraform vs. Ansible/Chef
• Terraform designed for infrastructure
– Not designed for configuration management
– Terraform deploys images
• Not good at maintaining what’s on those images
• If deployments update existing VMs
– You need Ansible, Chef, or Puppet
• If deployments are “new” VMs
– Terraform can handle deployments too
©2017 Derek C. Ashmore, All Rights Reserved 31
Paradigm Shift
• Deployment as new infrastructure
– New version  new VMs
• Software versions baked into images
– Advantages
• Facilitates Canary Deployments
– Route53 Routing Policies
• Go-live operation has less risk
– Deploy/Backout is just a load balancer switch
– Disadvantages
• More moving parts
• Impossible to do manually
©2017 Derek C. Ashmore, All Rights Reserved 32
Terraform vs CloudFormation
Terraform
• Scripting skills translate to Azure,
Google Cloud, etc.
• Less verbose (>50%)
• Data Lookups
• Custom Plug-ins possible
• Active Community Support
CloudFormation
• Quicker to follow AWS enhancements
• GUI support
• Automatic centralized state
• Vendor Support
©2017 Derek C. Ashmore, All Rights Reserved 33
Further Reading
• This slide deck
– http://www.slideshare.net/derekashmore
• The Gruntwork Blog
– https://blog.gruntwork.io/
©2017 Derek C. Ashmore, All Rights Reserved 34
Agenda
Microservices,
Docker, and
the Cloud
Cloud with
Terraform
Terraform’s
Competitors
Summary /
Q&A
Hands-On
Lab/Demo
©2017 Derek C. Ashmore, All Rights Reserved 35
Questions?
• Derek Ashmore:
– Blog: www.derekashmore.com
– LinkedIn: www.linkedin.com/in/derekashmore
• Connect Invites from attendees welcome
– Twitter: https://twitter.com/Derek_Ashmore
– GitHub: https://github.com/Derek-Ashmore
– Book: http://dvtpress.com/
©2017 Derek C. Ashmore, All Rights Reserved 36
Agenda
Microservices,
Docker, and
the Cloud
Cloud with
Terraform
Terraform’s
Competitors
Summary /
Q&A
Hands-On
Lab/Demo
©2017 Derek C. Ashmore, All Rights Reserved 37
Lab Resources
• This lab has set-up instructions on my github
– https://github.com/Derek-Ashmore/terraform-hands-on-lab
• Java Microservice to be deployed
– https://github.com/Derek-Ashmore/moneta
©2017 Derek C. Ashmore, All Rights Reserved 38
Beginning Steps
• Establish a command prompt at
– terraform-hands-on-labterraformdeploymentsterraform-lab
• SetUp Credential Environment Variables
– Windows: ....setkeys
– Mac/Linux: source ../../setkeys.sh
• Initialize the lab
– terraform init
©2017 Derek C. Ashmore, All Rights Reserved 39
The Lab Network at AWS – Stage 1
©2017 Derek C. Ashmore, All Rights Reserved 40
Sample Java/EE Microservice
• Moneta – Greek goddess of ‘memory’
– Open source: https://github.com/Derek-Ashmore/moneta
• Objective:
– Provide a RESTful Web Service interface to a relational database
• Feature set:
– Provides generic ‘core’ services
– Returns Json-formatted data
– Supports startRow and maxRows query options
– Supports a security call-out
– Built-in Dropwizard, Spring Boot, and War-file deployments
• Sample contract spec – currently read-only (writes in progress)
– /moneta/topics – lists ‘topics’ of information
• E.g. – Topic Customer configured
– /moneta/topic/customers?startRow=5&maxRows=25
– /moneta/topic/customer/111-222-333
• Docker deployment
– https://hub.docker.com/r/derekashmore/moneta-dropwizard/
©2015 Derek C. Ashmore, All Rights Reserved 41
The Lab Network at AWS – Stage 2
©2017 Derek C. Ashmore, All Rights Reserved 42
The Lab Network at AWS – Finished
©2017 Derek C. Ashmore, All Rights Reserved 43
Questions?
• Derek Ashmore:
– Blog: www.derekashmore.com
– LinkedIn: www.linkedin.com/in/derekashmore
• Connect Invites from attendees welcome
– Twitter: https://twitter.com/Derek_Ashmore
– GitHub: https://github.com/Derek-Ashmore
– Book: http://dvtpress.com/
©2017 Derek C. Ashmore, All Rights Reserved 44
terraform destroy

More Related Content

What's hot

Xen: Hypervisor for the Cloud - CCC13
Xen: Hypervisor for the Cloud - CCC13Xen: Hypervisor for the Cloud - CCC13
Xen: Hypervisor for the Cloud - CCC13
The Linux Foundation
 
Kernel Recipes 2014 - Xen as a foundation for cloud infrastructure
Kernel Recipes 2014 - Xen as a foundation for cloud infrastructureKernel Recipes 2014 - Xen as a foundation for cloud infrastructure
Kernel Recipes 2014 - Xen as a foundation for cloud infrastructure
Anne Nicolas
 
Leveraging CentOS and Xen for the Go Daddy Private Cloud
Leveraging CentOS and Xen for the Go Daddy Private CloudLeveraging CentOS and Xen for the Go Daddy Private Cloud
Leveraging CentOS and Xen for the Go Daddy Private Cloud
The Linux Foundation
 
Microservices for java architects coders-conf-2015-05-15
Microservices for java architects coders-conf-2015-05-15Microservices for java architects coders-conf-2015-05-15
Microservices for java architects coders-conf-2015-05-15
Derek Ashmore
 
Java Application Servers Are Dead!
Java Application Servers Are Dead!Java Application Servers Are Dead!
Java Application Servers Are Dead!
Eberhard Wolff
 
Erlang on Xen: Redefining the cloud software stack
Erlang on Xen:  Redefining the cloud software stackErlang on Xen:  Redefining the cloud software stack
Erlang on Xen: Redefining the cloud software stack
Viktor Sovietov
 
Moving Windows Applications to the Cloud
Moving Windows Applications to the CloudMoving Windows Applications to the Cloud
Moving Windows Applications to the Cloud
RightScale
 
LCEU13: Securing your cloud with Xen's advanced security features - George Du...
LCEU13: Securing your cloud with Xen's advanced security features - George Du...LCEU13: Securing your cloud with Xen's advanced security features - George Du...
LCEU13: Securing your cloud with Xen's advanced security features - George Du...
The Linux Foundation
 
Hybrid Cloud Tutorial Linkedin 2
Hybrid Cloud Tutorial Linkedin 2Hybrid Cloud Tutorial Linkedin 2
Hybrid Cloud Tutorial Linkedin 2
David Rilett
 
Xen: Hypervisor for the Cloud from Frontier Meetup Mountain View CA 2013-10-14
Xen: Hypervisor for the Cloud from Frontier Meetup Mountain View CA 2013-10-14Xen: Hypervisor for the Cloud from Frontier Meetup Mountain View CA 2013-10-14
Xen: Hypervisor for the Cloud from Frontier Meetup Mountain View CA 2013-10-14
The Linux Foundation
 
Henry been database-per-tenant with 50k databases
Henry been   database-per-tenant with 50k databasesHenry been   database-per-tenant with 50k databases
Henry been database-per-tenant with 50k databases
Henry Been
 
Building a multi-tenant application using 45.000 databases - Henry Been - Cod...
Building a multi-tenant application using 45.000 databases - Henry Been - Cod...Building a multi-tenant application using 45.000 databases - Henry Been - Cod...
Building a multi-tenant application using 45.000 databases - Henry Been - Cod...
Codemotion
 
Xen, XenServer, and XAPI: What’s the Difference?-XPUS13 Bulpin,Pavlicek
Xen, XenServer, and XAPI: What’s the Difference?-XPUS13 Bulpin,PavlicekXen, XenServer, and XAPI: What’s the Difference?-XPUS13 Bulpin,Pavlicek
Xen, XenServer, and XAPI: What’s the Difference?-XPUS13 Bulpin,Pavlicek
The Linux Foundation
 
Lift Introduction
Lift IntroductionLift Introduction
Lift Introduction
Indrajit Raychaudhuri
 
DOE Magellan OpenStack user story
DOE Magellan OpenStack user storyDOE Magellan OpenStack user story
DOE Magellan OpenStack user story
laurabeckcahoon
 
Practical solutions for connections administrators
Practical solutions for connections administratorsPractical solutions for connections administrators
Practical solutions for connections administrators
Sharon James
 
Presentation v mware v-cloud director technical overview
Presentation   v mware v-cloud director technical overviewPresentation   v mware v-cloud director technical overview
Presentation v mware v-cloud director technical overview
solarisyourep
 
OpenStack in action 4! Alessandro Pilotti - OpenStack, Hyper-V and Windows
OpenStack in action 4! Alessandro Pilotti - OpenStack, Hyper-V and WindowsOpenStack in action 4! Alessandro Pilotti - OpenStack, Hyper-V and Windows
OpenStack in action 4! Alessandro Pilotti - OpenStack, Hyper-V and Windows
eNovance
 

What's hot (20)

Xen: Hypervisor for the Cloud - CCC13
Xen: Hypervisor for the Cloud - CCC13Xen: Hypervisor for the Cloud - CCC13
Xen: Hypervisor for the Cloud - CCC13
 
Kernel Recipes 2014 - Xen as a foundation for cloud infrastructure
Kernel Recipes 2014 - Xen as a foundation for cloud infrastructureKernel Recipes 2014 - Xen as a foundation for cloud infrastructure
Kernel Recipes 2014 - Xen as a foundation for cloud infrastructure
 
Leveraging CentOS and Xen for the Go Daddy Private Cloud
Leveraging CentOS and Xen for the Go Daddy Private CloudLeveraging CentOS and Xen for the Go Daddy Private Cloud
Leveraging CentOS and Xen for the Go Daddy Private Cloud
 
Microservices for java architects coders-conf-2015-05-15
Microservices for java architects coders-conf-2015-05-15Microservices for java architects coders-conf-2015-05-15
Microservices for java architects coders-conf-2015-05-15
 
Java Application Servers Are Dead!
Java Application Servers Are Dead!Java Application Servers Are Dead!
Java Application Servers Are Dead!
 
Erlang on Xen: Redefining the cloud software stack
Erlang on Xen:  Redefining the cloud software stackErlang on Xen:  Redefining the cloud software stack
Erlang on Xen: Redefining the cloud software stack
 
Moving Windows Applications to the Cloud
Moving Windows Applications to the CloudMoving Windows Applications to the Cloud
Moving Windows Applications to the Cloud
 
LCEU13: Securing your cloud with Xen's advanced security features - George Du...
LCEU13: Securing your cloud with Xen's advanced security features - George Du...LCEU13: Securing your cloud with Xen's advanced security features - George Du...
LCEU13: Securing your cloud with Xen's advanced security features - George Du...
 
Hybrid Cloud Tutorial Linkedin 2
Hybrid Cloud Tutorial Linkedin 2Hybrid Cloud Tutorial Linkedin 2
Hybrid Cloud Tutorial Linkedin 2
 
Xen: Hypervisor for the Cloud from Frontier Meetup Mountain View CA 2013-10-14
Xen: Hypervisor for the Cloud from Frontier Meetup Mountain View CA 2013-10-14Xen: Hypervisor for the Cloud from Frontier Meetup Mountain View CA 2013-10-14
Xen: Hypervisor for the Cloud from Frontier Meetup Mountain View CA 2013-10-14
 
Elastic build environment
Elastic build environmentElastic build environment
Elastic build environment
 
Henry been database-per-tenant with 50k databases
Henry been   database-per-tenant with 50k databasesHenry been   database-per-tenant with 50k databases
Henry been database-per-tenant with 50k databases
 
Building a multi-tenant application using 45.000 databases - Henry Been - Cod...
Building a multi-tenant application using 45.000 databases - Henry Been - Cod...Building a multi-tenant application using 45.000 databases - Henry Been - Cod...
Building a multi-tenant application using 45.000 databases - Henry Been - Cod...
 
Xen, XenServer, and XAPI: What’s the Difference?-XPUS13 Bulpin,Pavlicek
Xen, XenServer, and XAPI: What’s the Difference?-XPUS13 Bulpin,PavlicekXen, XenServer, and XAPI: What’s the Difference?-XPUS13 Bulpin,Pavlicek
Xen, XenServer, and XAPI: What’s the Difference?-XPUS13 Bulpin,Pavlicek
 
Lift Introduction
Lift IntroductionLift Introduction
Lift Introduction
 
Peer to peer
Peer to peerPeer to peer
Peer to peer
 
DOE Magellan OpenStack user story
DOE Magellan OpenStack user storyDOE Magellan OpenStack user story
DOE Magellan OpenStack user story
 
Practical solutions for connections administrators
Practical solutions for connections administratorsPractical solutions for connections administrators
Practical solutions for connections administrators
 
Presentation v mware v-cloud director technical overview
Presentation   v mware v-cloud director technical overviewPresentation   v mware v-cloud director technical overview
Presentation v mware v-cloud director technical overview
 
OpenStack in action 4! Alessandro Pilotti - OpenStack, Hyper-V and Windows
OpenStack in action 4! Alessandro Pilotti - OpenStack, Hyper-V and WindowsOpenStack in action 4! Alessandro Pilotti - OpenStack, Hyper-V and Windows
OpenStack in action 4! Alessandro Pilotti - OpenStack, Hyper-V and Windows
 

Similar to Microservices with Terraform, Docker and the Cloud. JavaOne 2017 2017-10-02

Microservices with Terraform, Docker and the Cloud. Chicago Coders Conference...
Microservices with Terraform, Docker and the Cloud. Chicago Coders Conference...Microservices with Terraform, Docker and the Cloud. Chicago Coders Conference...
Microservices with Terraform, Docker and the Cloud. Chicago Coders Conference...
Derek Ashmore
 
Microservices with Terraform, Docker and the Cloud. IJug Chicago 2017-06-06
Microservices with Terraform, Docker and the Cloud. IJug Chicago 2017-06-06Microservices with Terraform, Docker and the Cloud. IJug Chicago 2017-06-06
Microservices with Terraform, Docker and the Cloud. IJug Chicago 2017-06-06
Derek Ashmore
 
Microservices with Terraform, Docker and the Cloud. DevOps Wet 2018
Microservices with Terraform, Docker and the Cloud. DevOps Wet 2018Microservices with Terraform, Docker and the Cloud. DevOps Wet 2018
Microservices with Terraform, Docker and the Cloud. DevOps Wet 2018
Derek Ashmore
 
Managing AWS Using Terraform AWS Atlanta 2018-07-18
Managing AWS Using Terraform AWS Atlanta 2018-07-18Managing AWS Using Terraform AWS Atlanta 2018-07-18
Managing AWS Using Terraform AWS Atlanta 2018-07-18
Derek Ashmore
 
Managing AWS Using Terraform AWS Chicago-Suburbs 2018-01-18
Managing AWS Using Terraform AWS Chicago-Suburbs 2018-01-18Managing AWS Using Terraform AWS Chicago-Suburbs 2018-01-18
Managing AWS Using Terraform AWS Chicago-Suburbs 2018-01-18
Derek Ashmore
 
Oracle cloud storage and file system
Oracle cloud storage and file systemOracle cloud storage and file system
Oracle cloud storage and file systemAndrejs Karpovs
 
Devoxx France 2015 - The Docker Orchestration Ecosystem on Azure
Devoxx France 2015 - The Docker Orchestration Ecosystem on AzureDevoxx France 2015 - The Docker Orchestration Ecosystem on Azure
Devoxx France 2015 - The Docker Orchestration Ecosystem on Azure
Patrick Chanezon
 
The Kubernetes WebLogic revival (part 1)
The Kubernetes WebLogic revival (part 1)The Kubernetes WebLogic revival (part 1)
The Kubernetes WebLogic revival (part 1)
Simon Haslam
 
Azure enterprise integration platform
Azure enterprise integration platformAzure enterprise integration platform
Azure enterprise integration platform
Michael Stephenson
 
Docker San Francisco Meetup April 2015 - The Docker Orchestration Ecosystem o...
Docker San Francisco Meetup April 2015 - The Docker Orchestration Ecosystem o...Docker San Francisco Meetup April 2015 - The Docker Orchestration Ecosystem o...
Docker San Francisco Meetup April 2015 - The Docker Orchestration Ecosystem o...
Patrick Chanezon
 
Managing ScaleIO as Software on Mesos - David vonThenen - Dell EMC World 2017
Managing ScaleIO as Software on Mesos - David vonThenen - Dell EMC World 2017Managing ScaleIO as Software on Mesos - David vonThenen - Dell EMC World 2017
Managing ScaleIO as Software on Mesos - David vonThenen - Dell EMC World 2017
{code} by Dell EMC
 
Managing ScaleIO as Software on Mesos
Managing ScaleIO as Software on MesosManaging ScaleIO as Software on Mesos
Managing ScaleIO as Software on Mesos
David vonThenen
 
Platform Provisioning Automation for Oracle Cloud
Platform Provisioning Automation for Oracle CloudPlatform Provisioning Automation for Oracle Cloud
Platform Provisioning Automation for Oracle Cloud
Simon Haslam
 
Best Practices for Deploying Enterprise Applications on UNIX
Best Practices for Deploying Enterprise Applications on UNIXBest Practices for Deploying Enterprise Applications on UNIX
Best Practices for Deploying Enterprise Applications on UNIX
Noel McKeown
 
EMC World 2016 - code.14 Deep Dive with Mesos and Persistent Storage for Appl...
EMC World 2016 - code.14 Deep Dive with Mesos and Persistent Storage for Appl...EMC World 2016 - code.14 Deep Dive with Mesos and Persistent Storage for Appl...
EMC World 2016 - code.14 Deep Dive with Mesos and Persistent Storage for Appl...
{code}
 
Introduction to Kubernetes
Introduction to KubernetesIntroduction to Kubernetes
Introduction to Kubernetes
Vishal Biyani
 
Postgres & Red Hat Cluster Suite
Postgres & Red Hat Cluster SuitePostgres & Red Hat Cluster Suite
Postgres & Red Hat Cluster Suite
EDB
 
Clocker - The Docker Cloud Maker
Clocker - The Docker Cloud MakerClocker - The Docker Cloud Maker
Clocker - The Docker Cloud Maker
Andrew Kennedy
 
To Build My Own Cloud with Blackjack…
To Build My Own Cloud with Blackjack…To Build My Own Cloud with Blackjack…
To Build My Own Cloud with Blackjack…
Sergey Dzyuban
 
Clocker: Managing Container Networking and Placement
Clocker: Managing Container Networking and PlacementClocker: Managing Container Networking and Placement
Clocker: Managing Container Networking and Placement
Docker, Inc.
 

Similar to Microservices with Terraform, Docker and the Cloud. JavaOne 2017 2017-10-02 (20)

Microservices with Terraform, Docker and the Cloud. Chicago Coders Conference...
Microservices with Terraform, Docker and the Cloud. Chicago Coders Conference...Microservices with Terraform, Docker and the Cloud. Chicago Coders Conference...
Microservices with Terraform, Docker and the Cloud. Chicago Coders Conference...
 
Microservices with Terraform, Docker and the Cloud. IJug Chicago 2017-06-06
Microservices with Terraform, Docker and the Cloud. IJug Chicago 2017-06-06Microservices with Terraform, Docker and the Cloud. IJug Chicago 2017-06-06
Microservices with Terraform, Docker and the Cloud. IJug Chicago 2017-06-06
 
Microservices with Terraform, Docker and the Cloud. DevOps Wet 2018
Microservices with Terraform, Docker and the Cloud. DevOps Wet 2018Microservices with Terraform, Docker and the Cloud. DevOps Wet 2018
Microservices with Terraform, Docker and the Cloud. DevOps Wet 2018
 
Managing AWS Using Terraform AWS Atlanta 2018-07-18
Managing AWS Using Terraform AWS Atlanta 2018-07-18Managing AWS Using Terraform AWS Atlanta 2018-07-18
Managing AWS Using Terraform AWS Atlanta 2018-07-18
 
Managing AWS Using Terraform AWS Chicago-Suburbs 2018-01-18
Managing AWS Using Terraform AWS Chicago-Suburbs 2018-01-18Managing AWS Using Terraform AWS Chicago-Suburbs 2018-01-18
Managing AWS Using Terraform AWS Chicago-Suburbs 2018-01-18
 
Oracle cloud storage and file system
Oracle cloud storage and file systemOracle cloud storage and file system
Oracle cloud storage and file system
 
Devoxx France 2015 - The Docker Orchestration Ecosystem on Azure
Devoxx France 2015 - The Docker Orchestration Ecosystem on AzureDevoxx France 2015 - The Docker Orchestration Ecosystem on Azure
Devoxx France 2015 - The Docker Orchestration Ecosystem on Azure
 
The Kubernetes WebLogic revival (part 1)
The Kubernetes WebLogic revival (part 1)The Kubernetes WebLogic revival (part 1)
The Kubernetes WebLogic revival (part 1)
 
Azure enterprise integration platform
Azure enterprise integration platformAzure enterprise integration platform
Azure enterprise integration platform
 
Docker San Francisco Meetup April 2015 - The Docker Orchestration Ecosystem o...
Docker San Francisco Meetup April 2015 - The Docker Orchestration Ecosystem o...Docker San Francisco Meetup April 2015 - The Docker Orchestration Ecosystem o...
Docker San Francisco Meetup April 2015 - The Docker Orchestration Ecosystem o...
 
Managing ScaleIO as Software on Mesos - David vonThenen - Dell EMC World 2017
Managing ScaleIO as Software on Mesos - David vonThenen - Dell EMC World 2017Managing ScaleIO as Software on Mesos - David vonThenen - Dell EMC World 2017
Managing ScaleIO as Software on Mesos - David vonThenen - Dell EMC World 2017
 
Managing ScaleIO as Software on Mesos
Managing ScaleIO as Software on MesosManaging ScaleIO as Software on Mesos
Managing ScaleIO as Software on Mesos
 
Platform Provisioning Automation for Oracle Cloud
Platform Provisioning Automation for Oracle CloudPlatform Provisioning Automation for Oracle Cloud
Platform Provisioning Automation for Oracle Cloud
 
Best Practices for Deploying Enterprise Applications on UNIX
Best Practices for Deploying Enterprise Applications on UNIXBest Practices for Deploying Enterprise Applications on UNIX
Best Practices for Deploying Enterprise Applications on UNIX
 
EMC World 2016 - code.14 Deep Dive with Mesos and Persistent Storage for Appl...
EMC World 2016 - code.14 Deep Dive with Mesos and Persistent Storage for Appl...EMC World 2016 - code.14 Deep Dive with Mesos and Persistent Storage for Appl...
EMC World 2016 - code.14 Deep Dive with Mesos and Persistent Storage for Appl...
 
Introduction to Kubernetes
Introduction to KubernetesIntroduction to Kubernetes
Introduction to Kubernetes
 
Postgres & Red Hat Cluster Suite
Postgres & Red Hat Cluster SuitePostgres & Red Hat Cluster Suite
Postgres & Red Hat Cluster Suite
 
Clocker - The Docker Cloud Maker
Clocker - The Docker Cloud MakerClocker - The Docker Cloud Maker
Clocker - The Docker Cloud Maker
 
To Build My Own Cloud with Blackjack…
To Build My Own Cloud with Blackjack…To Build My Own Cloud with Blackjack…
To Build My Own Cloud with Blackjack…
 
Clocker: Managing Container Networking and Placement
Clocker: Managing Container Networking and PlacementClocker: Managing Container Networking and Placement
Clocker: Managing Container Networking and Placement
 

Recently uploaded

BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
abdulrafaychaudhry
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 

Recently uploaded (20)

BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 

Microservices with Terraform, Docker and the Cloud. JavaOne 2017 2017-10-02

  • 1. Managing Microservices using Terraform, Docker, and the Cloud Given by Derek C. Ashmore JavaOne – Oct 2, 2017 ©2017 Derek C. Ashmore, All Rights Reserved 1
  • 2. Who am I? • Professional Geek since 1987 • Java/J2EE/Java EE since 1999 • AWS since 2010 • Specialties • Refactoring • Performance Tuning • Yes – I still code! ©2017 Derek C. Ashmore, All Rights Reserved 2
  • 3. Lab Preparation • This lab has set-up instructions on my github – https://github.com/Derek-Ashmore/terraform-hands-on-lab • Set up for the lab during the discussion! – It is socially acceptable – I will not wait for you to do the setup! – Feel free to treat the lab as a demo ©2017 Derek C. Ashmore, All Rights Reserved 3
  • 4. Discussion Resources • This slide deck – http://www.slideshare.net/derekashmore • The hands-on-lab code and setup instructions – https://github.com/Derek-Ashmore/terraform-hands-on-lab • The Moneta microservice (written in Java) – https://github.com/Derek-Ashmore/moneta • Slide deck has hyper-links! – Don’t bother writing down URLs ©2017 Derek C. Ashmore, All Rights Reserved 4
  • 5. Agenda Microservices, Docker, and the Cloud Cloud with Terraform Terraform’s Competitors Summary / Q&A Hands-On Lab/Demo ©2017 Derek C. Ashmore, All Rights Reserved 5
  • 6. What are Microservices? • No concrete definition • Common microservice traits – Single functional purpose • Most/all changes only impact one service • Not dependent on execution context – “loosely coupled” – Independent process/jvm – Stateless – Standard Interface (typically Web Service/REST) – Analogy: Stereo system, Linux utilities ©2017 Derek C. Ashmore, All Rights Reserved 6
  • 7. Microservices Application Architecture • Separate Databases • Eventual Consistency • More network activity ©2017 Derek C. Ashmore, All Rights Reserved 7
  • 8. Typical Microservice Library ©2017 Derek C. Ashmore, All Rights Reserved 8
  • 9. Microservice Deployments ©2017 Derek C. Ashmore, All Rights Reserved 9
  • 10. Docker • Is a “mini VM” • runs a linux kernal • Compare to shipping container • Standard “connections” to outside world • Supported formally by Oracle, Tomcat, Jboss, and many more 10©2017 Derek C. Ashmore, All Rights Reserved Package Once, Run Anywhere!
  • 11. Why Docker? • Docker is Win-Win – Easier for OPS and system administrators • All software looks the same • Standard interface for disk and network resources – Containers can be “linked” • Inherently automated – Easier for developers • Fewer environment difference issues • Less to communicate to OPS / system administrators • Easy to leverage work of others (docker-hub) – If you haven’t tried Docker yet – you should! ©2017 Derek C. Ashmore, All Rights Reserved 11
  • 12. Docker Build File • Docker file for Microservice Moneta – Base Image • FROM java:8-jre – Expose Folder • VOLUME /config – Download Moneta Jar Release • RUN curl -SL "$MONETA_URL" -o moneta-dropwizard.jar – Expose Ports • EXPOSE 8080 8081 – Run It • ENTRYPOINT exec java -classpath $CLASSPATH -server $JAVA_OPTS • -jar moneta-dropwizard.jar server /config/moneta-dropwizard.yaml ©2017 Derek C. Ashmore, All Rights Reserved 12
  • 13. Running a Docker Image • The Docker Run Command – Exposes Ports – Attaches Disk – Passes/sets Environment Variables – Allocates Memory • Example from the Lab Portion – export JAVA_OPTS="-Xmx768m” – docker pull derekashmore/moneta-dropwizard:0.9.3-alpha – docker run -d -p 80:8080 -m 800m -e JAVA_OPTS – -v $PWD/moneta-config:/config derekashmore/moneta-dropwizard:0.9.3-alpha ©2017 Derek C. Ashmore, All Rights Reserved 13
  • 14. Typical Microservice Install at AWS ©2017 Derek C. Ashmore, All Rights Reserved 14 • Horizontal scaling is supported • Multiple copies of microservice / web application running at the same time • Elastic Load Balancer distributes load across copies of your service • Sticky sessions available • ELB can use health checks • Autoscaling Groups scale number of copies up and down based on rules you give it • CPU Utilization or other metrics • Autoscaling Groups distribute across availability zones for availability
  • 15. Network Security ©2017 Derek C. Ashmore, All Rights Reserved 15
  • 16. Network Security (con’t) • Public vs. Private subnets – Specified by Routes and Network ACLs – Public subnets can be used from the internet • Web Servers typically placed here – Private subnets only used within your Virtual Network • Access from the internet just not possible – Even if a public IP is assigned • Microservices • Databases • Messaging traffic • It’s common to add SSO (for web applications) and OAUTH (for microservices) above that ©2017 Derek C. Ashmore, All Rights Reserved 16
  • 17. Security Groups • Security Groups provide Inbound/Outbound rules for individual instances – Think of as “an assignable firewall” – Multiple rules per VM allowed. – Easy additional layer of security – No changes to applications or services needed. • Examples – Web Servers  Allow port 80 and 443 from anywhere – Web Servers  Allow SSH/SFTP only from within the VPC • Security Groups and be associated – Financial Microservice Allow port 443 only from VMs belonging to security group FINANCIAL_SERVICE_CLIENT_SG – Oracle Database  Allow port 1521 only from VMs belonging to security group ORACLE_CLIENT_SG ©2017 Derek C. Ashmore, All Rights Reserved 17
  • 18. Managing Cloud Assets • Objectives – Managing Complexity • Environment Consistency • Environment Lifecycle Support • Ease of change • Reuse – Manage risk of change – Mitigate Cloud Lock-in • Infrastructure as Code – Reusable Infrastructure Components • Leverage work/expertise of others • Big problem  Smaller manageable problems – Change Tracking – Source Control ©2017 Derek C. Ashmore, All Rights Reserved 18
  • 19. Agenda Microservices, Docker, and the Cloud Cloud with Terraform Terraform’s Competitors Summary / Q&A Hands-On Lab/Demo ©2017 Derek C. Ashmore, All Rights Reserved 19
  • 20. Terraform • Cloud Management – Open Source • Very active community – Extensible to any cloud vendor • AWS, Azure, GCP, AliCloud, Digital Ocean, OpenStack – Supported for Cloud Support products • Chef, Consul, Kubernetes, Datadog • 62 Providers as of April, 2017 and growing ©2017 Derek C. Ashmore, All Rights Reserved 20
  • 21. Terraform HCL • Declarative Language – Describe what the end product contains • Terraform figures out how to get there – Terraform Resources • Describes deployed artifacts – Network  Virtual Networks, Subnets, Network ACLs, Gateways, ELB/ALB – Hosts  Virtual Machines, Databases – Security  Security groups/policies/roles/groups/users – Much more ©2017 Derek C. Ashmore, All Rights Reserved 21
  • 22. Terraform Basics • Declarative Programming – All *.tf files loaded  Terraform decides execution order – No GUI  All command line and text editor • Top Commands – Terraform plan  Describes planned changes – Terraform apply  Makes planned changes – Terraform taint  Forces re-creation of a resource – Terraform destroy  deletes all resources ©2017 Derek C. Ashmore, All Rights Reserved 22
  • 23. Terraform Resources • AWS Subnet Resource – Count = 3  Three subnets created – Availability Zones come from a data source (lookup) – CIDR blocks are input variables • Sample source ©2017 Derek C. Ashmore, All Rights Reserved 23
  • 24. Terraform Data Sources • Example Data Sources (lookups) • Sample source ©2017 Derek C. Ashmore, All Rights Reserved 24
  • 25. Terraform Providers • Example Provider • Sample AWS source • Azure Provider ©2017 Derek C. Ashmore, All Rights Reserved 25
  • 26. Terraform Input Variables • Example Provider • Sample source ©2017 Derek C. Ashmore, All Rights Reserved 26
  • 27. Reusing Terraform Templates • Example Template Reuse • Sample source ©2017 Derek C. Ashmore, All Rights Reserved 27
  • 28. Typical Project Structure ©2017 Derek C. Ashmore, All Rights Reserved 28
  • 29. Terraform State • Terraform stores state – Local file terraform.tfstate • Teams need to manage state centrally – Terraform Backends • Locks so that only one person at a time can update • Remote storage – S3, Azure containers, Google cloud storage, etc. ©2017 Derek C. Ashmore, All Rights Reserved 29
  • 30. Agenda Microservices, Docker, and the Cloud Cloud with Terraform Terraform’s Competitors Summary / Q&A Hands-On Lab/Demo ©2017 Derek C. Ashmore, All Rights Reserved 30
  • 31. Terraform vs. Ansible/Chef • Terraform designed for infrastructure – Not designed for configuration management – Terraform deploys images • Not good at maintaining what’s on those images • If deployments update existing VMs – You need Ansible, Chef, or Puppet • If deployments are “new” VMs – Terraform can handle deployments too ©2017 Derek C. Ashmore, All Rights Reserved 31
  • 32. Paradigm Shift • Deployment as new infrastructure – New version  new VMs • Software versions baked into images – Advantages • Facilitates Canary Deployments – Route53 Routing Policies • Go-live operation has less risk – Deploy/Backout is just a load balancer switch – Disadvantages • More moving parts • Impossible to do manually ©2017 Derek C. Ashmore, All Rights Reserved 32
  • 33. Terraform vs CloudFormation Terraform • Scripting skills translate to Azure, Google Cloud, etc. • Less verbose (>50%) • Data Lookups • Custom Plug-ins possible • Active Community Support CloudFormation • Quicker to follow AWS enhancements • GUI support • Automatic centralized state • Vendor Support ©2017 Derek C. Ashmore, All Rights Reserved 33
  • 34. Further Reading • This slide deck – http://www.slideshare.net/derekashmore • The Gruntwork Blog – https://blog.gruntwork.io/ ©2017 Derek C. Ashmore, All Rights Reserved 34
  • 35. Agenda Microservices, Docker, and the Cloud Cloud with Terraform Terraform’s Competitors Summary / Q&A Hands-On Lab/Demo ©2017 Derek C. Ashmore, All Rights Reserved 35
  • 36. Questions? • Derek Ashmore: – Blog: www.derekashmore.com – LinkedIn: www.linkedin.com/in/derekashmore • Connect Invites from attendees welcome – Twitter: https://twitter.com/Derek_Ashmore – GitHub: https://github.com/Derek-Ashmore – Book: http://dvtpress.com/ ©2017 Derek C. Ashmore, All Rights Reserved 36
  • 37. Agenda Microservices, Docker, and the Cloud Cloud with Terraform Terraform’s Competitors Summary / Q&A Hands-On Lab/Demo ©2017 Derek C. Ashmore, All Rights Reserved 37
  • 38. Lab Resources • This lab has set-up instructions on my github – https://github.com/Derek-Ashmore/terraform-hands-on-lab • Java Microservice to be deployed – https://github.com/Derek-Ashmore/moneta ©2017 Derek C. Ashmore, All Rights Reserved 38
  • 39. Beginning Steps • Establish a command prompt at – terraform-hands-on-labterraformdeploymentsterraform-lab • SetUp Credential Environment Variables – Windows: ....setkeys – Mac/Linux: source ../../setkeys.sh • Initialize the lab – terraform init ©2017 Derek C. Ashmore, All Rights Reserved 39
  • 40. The Lab Network at AWS – Stage 1 ©2017 Derek C. Ashmore, All Rights Reserved 40
  • 41. Sample Java/EE Microservice • Moneta – Greek goddess of ‘memory’ – Open source: https://github.com/Derek-Ashmore/moneta • Objective: – Provide a RESTful Web Service interface to a relational database • Feature set: – Provides generic ‘core’ services – Returns Json-formatted data – Supports startRow and maxRows query options – Supports a security call-out – Built-in Dropwizard, Spring Boot, and War-file deployments • Sample contract spec – currently read-only (writes in progress) – /moneta/topics – lists ‘topics’ of information • E.g. – Topic Customer configured – /moneta/topic/customers?startRow=5&maxRows=25 – /moneta/topic/customer/111-222-333 • Docker deployment – https://hub.docker.com/r/derekashmore/moneta-dropwizard/ ©2015 Derek C. Ashmore, All Rights Reserved 41
  • 42. The Lab Network at AWS – Stage 2 ©2017 Derek C. Ashmore, All Rights Reserved 42
  • 43. The Lab Network at AWS – Finished ©2017 Derek C. Ashmore, All Rights Reserved 43
  • 44. Questions? • Derek Ashmore: – Blog: www.derekashmore.com – LinkedIn: www.linkedin.com/in/derekashmore • Connect Invites from attendees welcome – Twitter: https://twitter.com/Derek_Ashmore – GitHub: https://github.com/Derek-Ashmore – Book: http://dvtpress.com/ ©2017 Derek C. Ashmore, All Rights Reserved 44 terraform destroy