SlideShare ist ein Scribd-Unternehmen logo
1 von 19
UFO
Tung Nguyen
Jan 2017
About Me
I’ve done a little bit of everything. Both dev and ops.
@tongueroo - Twitter.
https://medium.com/@tongueroo - Blog.
tongueroo.com - Personal Site.
lono - CloudFormation template generator.
jack - Manage ElasticBeanstalk environments.
thor_template - used this to generate this tool.
ufo - ship docker images to ecs. What this talk is about.
These tools are in Ruby.
More: http://tongueroo.com/projects/
Other Tools
Why?
Wanted get my hands dirty with ECS.
Wanted more control over the ECS task definition.
Wanted to automated the building of the docker image as
part of building task definition.
Ending up using it on my side projects.
ECS Introduction - Terms
Task definition - blueprint for docker container.
Task - Actual running container.
Service - Long running tasks.
Cluster - Logic group of EC2 Container instances.
Container Instance - EC2 instance that is part of an ECS
Cluster.
ECS Introduction - Terms
Steps for Deploying on ECS
1.Build and push docker image
2.Build and register task definition
3.Update the ECS service (create the service if needed)
Google Search: “deploying to ecs”
silinternational/ecs-deploy - pulls down existing task
definition.
CircleCI deploy.sh example - nice and simple easy to build
from.
Empire - heroku like opensource SaaS from Remind
engineering. A little more than I need but cool project.
Programmer Virtue #1: Laziness ->
Research
Wanted more control over the task definition template.
Would be nice if the task definition could be reused for
common and similar processes: web, clock, worker.
More Control
Task Definition Similarities
$ cat ufo/output/hi-web.json
{
"family": "hi-web",
"containerDefinitions": [
{
"name": "web",
"image": "tongueroo/hi:ufo-2016-12-04T17-54-
23-2d1634d",
"cpu": 128,
"memoryReservation": 256,
"portMappings": [
{
"containerPort": "3000",
"protocol": "tcp"
}
],
"command": [
"bin/web"
],
"environment": [
{
"name": "ADMIN_PASSWORD",
"value": "secret"
}
],
"essential": true
$ cat ufo/output/hi-worker.json
{
"family": "hi-worker",
"containerDefinitions": [
{
"name": "worker",
"image": "tongueroo/hi:ufo-2016-12-04T17-54-
23-2d1634d",
"cpu": 128,
"memoryReservation": 256,
"command": [
"bin/worker"
],
"environment": [
{
"name": "ADMIN_PASSWORD",
"value": "secret"
}
],
"essential": true
}
]
}$
UFO Template DSL
UFO will use a ERB template to generate the task
definition for all the processes you need: web, clock,
worker, etc.
Allows sharing of code and settings.
Let’s see what it looks like.
UFO Task Definition Template DSL
$ cat ufo/templates/main.json.erb
{
"family": "<%= @family %>",
"containerDefinitions": [
{
"name": "<%= @name %>",
"image": "<%= @image %>",
"cpu": <%= @cpu %>,
<% if @memory %>
"memory": <%= @memory %>,
<% end %>
<% if @memory_reservation %>
"memoryReservation": <%=
@memory_reservation %>,
<% end %>
<% if @container_port %>
"portMappings": [
{
"containerPort": "<%=
@container_port %>",
"protocol": "tcp"
}
],
<% end %>
"command": <%= @command.to_json %>,
<% if @environment %>
$ cat ufo/task_definitions.rb
common = {
image: helper.full_image_name,
cpu: 128,
memory_reservation: 256,
environment: env_file(".env")
}
task_definition "hi-web" do
source "main"
variables(common.dup.deep_merge(
family: task_definition_name,
name: "web",
container_port: helper.dockerfile_port,
command: ["bin/web"]
))
end
task_definition "hi-worker" do
source "main"
variables(common.dup.deep_merge(
family: task_definition_name,
name: "worker",
command: ["bin/worker"]
))
end
UFO Task Definition Output
$ cat ufo/output/hi-web.json
{
"family": "hi-web",
"containerDefinitions": [
{
"name": "web",
"image": "tongueroo/hi:ufo-2016-12-04T17-54-
23-2d1634d",
"cpu": 128,
"memoryReservation": 256,
"portMappings": [
{
"containerPort": "3000",
"protocol": "tcp"
}
],
"command": [
"bin/web"
],
"environment": [
{
"name": "ADMIN_PASSWORD",
"value": "secret"
}
],
"essential": true
$ cat ufo/output/hi-worker.json
{
"family": "hi-worker",
"containerDefinitions": [
{
"name": "worker",
"image": "tongueroo/hi:ufo-2016-12-04T17-54-
23-2d1634d",
"cpu": 128,
"memoryReservation": 256,
"command": [
"bin/worker"
],
"environment": [
{
"name": "ADMIN_PASSWORD",
"value": "secret"
}
],
"essential": true
}
]
}$
ufo ship: whole point of this tool
NOTE: The ECS Cluster and a Container Instance must
already exist. I created Container Instances with the lono
tool.
1. Build and push docker image
2. Build and register task definition
3. Update the ECS service (create the
service automatically if needed)
UFO Demo
ufo ship demo
What Happened Review Summary
ufo init - generates the skeleton ufo files.
Mainly ufo/task_definitons.rb and
ufo/templates/main.json.erb - most configurations and
changes go in here.
ufo/settings.yml - is nice to know about a useful setting in
here.
bin/deploy - wrapper script.
In ufo/task_definitions.rb there are some helper methods.
helper.full_image_name - this is the generated docker
image name.
helper.dockerfile_port - parsed from the Dockerfile.
env_file - useful helper method to translate a env list to
the json formatted list for an ECS Task definition.
Review tasks_definitions.rb Helpers
ufo docker build - only build the docker image
ufo tasks build - only build the task definitions
ufo scale hi-web 1 - scale up and down tasks
Misc ufo commands
THE END
Hacker Noon Blog Post - Ufo—Easily Build Docker Images
and Ship Containers to AWS ECS
Setting up CI with UFO, ECS, and CircleCI
GitHub - https://github.com/tongueroo/ufo
Slideshare - http://www.slideshare.net/tongueroo/ufo-
ship-for-aws-ecs-70885296
tongueroo@gmail.com - feel free to contact me

Weitere ähnliche Inhalte

Was ist angesagt?

Puppet and CloudStack
Puppet and CloudStackPuppet and CloudStack
Puppet and CloudStackke4qqq
 
Packer, where DevOps begins
Packer, where DevOps beginsPacker, where DevOps begins
Packer, where DevOps beginsJeff Hung
 
wwc start-launched
wwc start-launchedwwc start-launched
wwc start-launchedMat Schaffer
 
Puppet at janrain
Puppet at janrainPuppet at janrain
Puppet at janrainPuppet
 
Automation with Packer and TerraForm
Automation with Packer and TerraFormAutomation with Packer and TerraForm
Automation with Packer and TerraFormWesley Charles Blake
 
Go-Couchbase Golang Paris 2015/12/17
Go-Couchbase Golang Paris 2015/12/17Go-Couchbase Golang Paris 2015/12/17
Go-Couchbase Golang Paris 2015/12/17Edouard Buschini
 
Elasticsearch (R)Evolution — You Know, for Search… by Philipp Krenn at Big Da...
Elasticsearch (R)Evolution — You Know, for Search… by Philipp Krenn at Big Da...Elasticsearch (R)Evolution — You Know, for Search… by Philipp Krenn at Big Da...
Elasticsearch (R)Evolution — You Know, for Search… by Philipp Krenn at Big Da...Big Data Spain
 
Nikita Tuk: Handling background processes in iOS: problems & solutions
Nikita Tuk: Handling background processes in iOS: problems & solutionsNikita Tuk: Handling background processes in iOS: problems & solutions
Nikita Tuk: Handling background processes in iOS: problems & solutionsmdevtalk
 
AnsibleFest 2014 - Role Tips and Tricks
AnsibleFest 2014 - Role Tips and TricksAnsibleFest 2014 - Role Tips and Tricks
AnsibleFest 2014 - Role Tips and Tricksjimi-c
 
Ansible fest Presentation slides
Ansible fest Presentation slidesAnsible fest Presentation slides
Ansible fest Presentation slidesAaron Carey
 
Deployment with Fabric
Deployment with FabricDeployment with Fabric
Deployment with Fabricandymccurdy
 
Ansible for beginners ...?
Ansible for beginners ...?Ansible for beginners ...?
Ansible for beginners ...?shirou wakayama
 
Weird things we've seen with OpenStack Neutron
Weird things we've seen with OpenStack NeutronWeird things we've seen with OpenStack Neutron
Weird things we've seen with OpenStack NeutronNick Jones
 
A Introduction of Packer
A Introduction of PackerA Introduction of Packer
A Introduction of PackerFreyr Lin
 
Data integration with embulk
Data integration with embulkData integration with embulk
Data integration with embulkTeguh Nugraha
 
Functional Hostnames and Why they are Bad
Functional Hostnames and Why they are BadFunctional Hostnames and Why they are Bad
Functional Hostnames and Why they are BadPuppet
 
Building Docker images with Puppet
Building Docker images with PuppetBuilding Docker images with Puppet
Building Docker images with PuppetNick Jones
 
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.Graham Dumpleton
 

Was ist angesagt? (20)

Puppet and CloudStack
Puppet and CloudStackPuppet and CloudStack
Puppet and CloudStack
 
Packer, where DevOps begins
Packer, where DevOps beginsPacker, where DevOps begins
Packer, where DevOps begins
 
wwc start-launched
wwc start-launchedwwc start-launched
wwc start-launched
 
Puppet at janrain
Puppet at janrainPuppet at janrain
Puppet at janrain
 
RingoJS
RingoJSRingoJS
RingoJS
 
Automation with Packer and TerraForm
Automation with Packer and TerraFormAutomation with Packer and TerraForm
Automation with Packer and TerraForm
 
Go-Couchbase Golang Paris 2015/12/17
Go-Couchbase Golang Paris 2015/12/17Go-Couchbase Golang Paris 2015/12/17
Go-Couchbase Golang Paris 2015/12/17
 
Apache Cassandra and Go
Apache Cassandra and GoApache Cassandra and Go
Apache Cassandra and Go
 
Elasticsearch (R)Evolution — You Know, for Search… by Philipp Krenn at Big Da...
Elasticsearch (R)Evolution — You Know, for Search… by Philipp Krenn at Big Da...Elasticsearch (R)Evolution — You Know, for Search… by Philipp Krenn at Big Da...
Elasticsearch (R)Evolution — You Know, for Search… by Philipp Krenn at Big Da...
 
Nikita Tuk: Handling background processes in iOS: problems & solutions
Nikita Tuk: Handling background processes in iOS: problems & solutionsNikita Tuk: Handling background processes in iOS: problems & solutions
Nikita Tuk: Handling background processes in iOS: problems & solutions
 
AnsibleFest 2014 - Role Tips and Tricks
AnsibleFest 2014 - Role Tips and TricksAnsibleFest 2014 - Role Tips and Tricks
AnsibleFest 2014 - Role Tips and Tricks
 
Ansible fest Presentation slides
Ansible fest Presentation slidesAnsible fest Presentation slides
Ansible fest Presentation slides
 
Deployment with Fabric
Deployment with FabricDeployment with Fabric
Deployment with Fabric
 
Ansible for beginners ...?
Ansible for beginners ...?Ansible for beginners ...?
Ansible for beginners ...?
 
Weird things we've seen with OpenStack Neutron
Weird things we've seen with OpenStack NeutronWeird things we've seen with OpenStack Neutron
Weird things we've seen with OpenStack Neutron
 
A Introduction of Packer
A Introduction of PackerA Introduction of Packer
A Introduction of Packer
 
Data integration with embulk
Data integration with embulkData integration with embulk
Data integration with embulk
 
Functional Hostnames and Why they are Bad
Functional Hostnames and Why they are BadFunctional Hostnames and Why they are Bad
Functional Hostnames and Why they are Bad
 
Building Docker images with Puppet
Building Docker images with PuppetBuilding Docker images with Puppet
Building Docker images with Puppet
 
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
 

Andere mochten auch

UfO's presentation
UfO's presentationUfO's presentation
UfO's presentationAditya Bhatt
 
UFO: Sebuah Analisa dan Implikasi
UFO: Sebuah Analisa dan ImplikasiUFO: Sebuah Analisa dan Implikasi
UFO: Sebuah Analisa dan ImplikasiNur Agustinus
 
Center for the New Age - UFO Tours
Center for the New Age - UFO ToursCenter for the New Age - UFO Tours
Center for the New Age - UFO ToursCenterforthe Light
 
Project Blue Book
Project Blue BookProject Blue Book
Project Blue BookKukuasu
 
J. Allen Hynek - The UFO Experience - A Scientific Inquiry (1972)
J. Allen Hynek - The UFO Experience - A Scientific Inquiry (1972)J. Allen Hynek - The UFO Experience - A Scientific Inquiry (1972)
J. Allen Hynek - The UFO Experience - A Scientific Inquiry (1972)DirkTheDaring11
 
UFOs: Abduction by the marketing hype cycle
UFOs: Abduction by the marketing hype cycleUFOs: Abduction by the marketing hype cycle
UFOs: Abduction by the marketing hype cycleArmando Alves
 
Ghosts,Demons,Mermaids and Aliens...
Ghosts,Demons,Mermaids and Aliens...Ghosts,Demons,Mermaids and Aliens...
Ghosts,Demons,Mermaids and Aliens...Guneet Singh
 
Presentation1ghost facts
Presentation1ghost factsPresentation1ghost facts
Presentation1ghost factshudanasreen
 
Music presentation.ppt
Music presentation.pptMusic presentation.ppt
Music presentation.pptToni
 
Study: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsStudy: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsLinkedIn
 
UX, ethnography and possibilities: for Libraries, Museums and Archives
UX, ethnography and possibilities: for Libraries, Museums and ArchivesUX, ethnography and possibilities: for Libraries, Museums and Archives
UX, ethnography and possibilities: for Libraries, Museums and ArchivesNed Potter
 
Hype vs. Reality: The AI Explainer
Hype vs. Reality: The AI ExplainerHype vs. Reality: The AI Explainer
Hype vs. Reality: The AI ExplainerLuminary Labs
 

Andere mochten auch (20)

UfO's presentation
UfO's presentationUfO's presentation
UfO's presentation
 
Ufo
UfoUfo
Ufo
 
Ufo
UfoUfo
Ufo
 
UFO: Sebuah Analisa dan Implikasi
UFO: Sebuah Analisa dan ImplikasiUFO: Sebuah Analisa dan Implikasi
UFO: Sebuah Analisa dan Implikasi
 
UFO & Aliens
UFO & AliensUFO & Aliens
UFO & Aliens
 
Center for the New Age - UFO Tours
Center for the New Age - UFO ToursCenter for the New Age - UFO Tours
Center for the New Age - UFO Tours
 
Project Blue Book
Project Blue BookProject Blue Book
Project Blue Book
 
J. Allen Hynek - The UFO Experience - A Scientific Inquiry (1972)
J. Allen Hynek - The UFO Experience - A Scientific Inquiry (1972)J. Allen Hynek - The UFO Experience - A Scientific Inquiry (1972)
J. Allen Hynek - The UFO Experience - A Scientific Inquiry (1972)
 
UFOs: Abduction by the marketing hype cycle
UFOs: Abduction by the marketing hype cycleUFOs: Abduction by the marketing hype cycle
UFOs: Abduction by the marketing hype cycle
 
Ufo-fact or fiction
Ufo-fact or fictionUfo-fact or fiction
Ufo-fact or fiction
 
Ghosts,Demons,Mermaids and Aliens...
Ghosts,Demons,Mermaids and Aliens...Ghosts,Demons,Mermaids and Aliens...
Ghosts,Demons,Mermaids and Aliens...
 
The History Of Classical Music (1600 2000)
The History Of Classical Music (1600 2000)The History Of Classical Music (1600 2000)
The History Of Classical Music (1600 2000)
 
English ppt ufo
English ppt ufoEnglish ppt ufo
English ppt ufo
 
Presentation1ghost facts
Presentation1ghost factsPresentation1ghost facts
Presentation1ghost facts
 
Ghost
GhostGhost
Ghost
 
Music presentation.ppt
Music presentation.pptMusic presentation.ppt
Music presentation.ppt
 
Wi max
Wi maxWi max
Wi max
 
Study: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsStudy: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving Cars
 
UX, ethnography and possibilities: for Libraries, Museums and Archives
UX, ethnography and possibilities: for Libraries, Museums and ArchivesUX, ethnography and possibilities: for Libraries, Museums and Archives
UX, ethnography and possibilities: for Libraries, Museums and Archives
 
Hype vs. Reality: The AI Explainer
Hype vs. Reality: The AI ExplainerHype vs. Reality: The AI Explainer
Hype vs. Reality: The AI Explainer
 

Ähnlich wie Automate Docker Deployments to AWS ECS with UFO

Amazon Web Services and Docker: from developing to production
Amazon Web Services and Docker: from developing to productionAmazon Web Services and Docker: from developing to production
Amazon Web Services and Docker: from developing to productionPaolo latella
 
Ansible with oci
Ansible with ociAnsible with oci
Ansible with ociDonghuKIM2
 
Puppetpreso
PuppetpresoPuppetpreso
Puppetpresoke4qqq
 
Puppet and Apache CloudStack
Puppet and Apache CloudStackPuppet and Apache CloudStack
Puppet and Apache CloudStackPuppet
 
An intro to Docker, Terraform, and Amazon ECS
An intro to Docker, Terraform, and Amazon ECSAn intro to Docker, Terraform, and Amazon ECS
An intro to Docker, Terraform, and Amazon ECSYevgeniy Brikman
 
Containers, Docker, and Microservices: the Terrific Trio
Containers, Docker, and Microservices: the Terrific TrioContainers, Docker, and Microservices: the Terrific Trio
Containers, Docker, and Microservices: the Terrific TrioJérôme Petazzoni
 
Kubernetes for the PHP developer
Kubernetes for the PHP developerKubernetes for the PHP developer
Kubernetes for the PHP developerPaul Czarkowski
 
Novices guide to docker
Novices guide to dockerNovices guide to docker
Novices guide to dockerAlec Clews
 
Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013grim_radical
 
Docker Online Meetup #3: Docker in Production
Docker Online Meetup #3: Docker in ProductionDocker Online Meetup #3: Docker in Production
Docker Online Meetup #3: Docker in ProductionDocker, Inc.
 
Ansible inside
Ansible insideAnsible inside
Ansible insideIdeato
 
Build Your Own CaaS (Container as a Service)
Build Your Own CaaS (Container as a Service)Build Your Own CaaS (Container as a Service)
Build Your Own CaaS (Container as a Service)HungWei Chiu
 
Fullstack conf 2017 - Basic dev pipeline end-to-end
Fullstack conf 2017 - Basic dev pipeline end-to-endFullstack conf 2017 - Basic dev pipeline end-to-end
Fullstack conf 2017 - Basic dev pipeline end-to-endEzequiel Maraschio
 
Learn you some Ansible for great good!
Learn you some Ansible for great good!Learn you some Ansible for great good!
Learn you some Ansible for great good!David Lapsley
 
Cloud Foundry V2 | Intermediate Deep Dive
Cloud Foundry V2 | Intermediate Deep DiveCloud Foundry V2 | Intermediate Deep Dive
Cloud Foundry V2 | Intermediate Deep DiveKazuto Kusama
 
Null Bachaav - May 07 Attack Monitoring workshop.
Null Bachaav - May 07 Attack Monitoring workshop.Null Bachaav - May 07 Attack Monitoring workshop.
Null Bachaav - May 07 Attack Monitoring workshop.Prajal Kulkarni
 

Ähnlich wie Automate Docker Deployments to AWS ECS with UFO (20)

Amazon Web Services and Docker: from developing to production
Amazon Web Services and Docker: from developing to productionAmazon Web Services and Docker: from developing to production
Amazon Web Services and Docker: from developing to production
 
Ansible with oci
Ansible with ociAnsible with oci
Ansible with oci
 
Puppetpreso
PuppetpresoPuppetpreso
Puppetpreso
 
Puppet and Apache CloudStack
Puppet and Apache CloudStackPuppet and Apache CloudStack
Puppet and Apache CloudStack
 
Discovering OpenBSD on AWS
Discovering OpenBSD on AWSDiscovering OpenBSD on AWS
Discovering OpenBSD on AWS
 
An intro to Docker, Terraform, and Amazon ECS
An intro to Docker, Terraform, and Amazon ECSAn intro to Docker, Terraform, and Amazon ECS
An intro to Docker, Terraform, and Amazon ECS
 
Containers, Docker, and Microservices: the Terrific Trio
Containers, Docker, and Microservices: the Terrific TrioContainers, Docker, and Microservices: the Terrific Trio
Containers, Docker, and Microservices: the Terrific Trio
 
Kubernetes for the PHP developer
Kubernetes for the PHP developerKubernetes for the PHP developer
Kubernetes for the PHP developer
 
Novices guide to docker
Novices guide to dockerNovices guide to docker
Novices guide to docker
 
Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013
 
Docker 101
Docker 101 Docker 101
Docker 101
 
Docker Online Meetup #3: Docker in Production
Docker Online Meetup #3: Docker in ProductionDocker Online Meetup #3: Docker in Production
Docker Online Meetup #3: Docker in Production
 
Docker, c'est bonheur !
Docker, c'est bonheur !Docker, c'est bonheur !
Docker, c'est bonheur !
 
Ansible inside
Ansible insideAnsible inside
Ansible inside
 
Build Your Own CaaS (Container as a Service)
Build Your Own CaaS (Container as a Service)Build Your Own CaaS (Container as a Service)
Build Your Own CaaS (Container as a Service)
 
Fullstack conf 2017 - Basic dev pipeline end-to-end
Fullstack conf 2017 - Basic dev pipeline end-to-endFullstack conf 2017 - Basic dev pipeline end-to-end
Fullstack conf 2017 - Basic dev pipeline end-to-end
 
Learn you some Ansible for great good!
Learn you some Ansible for great good!Learn you some Ansible for great good!
Learn you some Ansible for great good!
 
Cloud Foundry V2 | Intermediate Deep Dive
Cloud Foundry V2 | Intermediate Deep DiveCloud Foundry V2 | Intermediate Deep Dive
Cloud Foundry V2 | Intermediate Deep Dive
 
Null Bachaav - May 07 Attack Monitoring workshop.
Null Bachaav - May 07 Attack Monitoring workshop.Null Bachaav - May 07 Attack Monitoring workshop.
Null Bachaav - May 07 Attack Monitoring workshop.
 
ABCs of docker
ABCs of dockerABCs of docker
ABCs of docker
 

Mehr von Tung Nguyen

re:Invent 2019 Highly Available ECS Spot Architecture: Save 50%-90%
re:Invent 2019 Highly Available ECS Spot Architecture: Save 50%-90%re:Invent 2019 Highly Available ECS Spot Architecture: Save 50%-90%
re:Invent 2019 Highly Available ECS Spot Architecture: Save 50%-90%Tung Nguyen
 
Jets: The Ruby Serverless Framework Nashville Tennessee 2019 August
Jets: The Ruby Serverless Framework Nashville Tennessee 2019 AugustJets: The Ruby Serverless Framework Nashville Tennessee 2019 August
Jets: The Ruby Serverless Framework Nashville Tennessee 2019 AugustTung Nguyen
 
Jets: The Ruby Serverless Framework Balkan Ruby Bulgaria 2019 May
Jets: The Ruby Serverless Framework Balkan Ruby Bulgaria 2019 MayJets: The Ruby Serverless Framework Balkan Ruby Bulgaria 2019 May
Jets: The Ruby Serverless Framework Balkan Ruby Bulgaria 2019 MayTung Nguyen
 
Jets: The Ruby Serverless Framework Ruby Kaigi Japan 2019 April
Jets: The Ruby Serverless Framework Ruby Kaigi Japan 2019 AprilJets: The Ruby Serverless Framework Ruby Kaigi Japan 2019 April
Jets: The Ruby Serverless Framework Ruby Kaigi Japan 2019 AprilTung Nguyen
 
Getting Started with ECS: An Easy Way to Run Docker Containers - AWS Summit A...
Getting Started with ECS: An Easy Way to Run Docker Containers - AWS Summit A...Getting Started with ECS: An Easy Way to Run Docker Containers - AWS Summit A...
Getting Started with ECS: An Easy Way to Run Docker Containers - AWS Summit A...Tung Nguyen
 
Ruby Conference Belarus 2019 Apr Jets Ruby Serverless Framework
Ruby Conference Belarus 2019 Apr Jets Ruby Serverless FrameworkRuby Conference Belarus 2019 Apr Jets Ruby Serverless Framework
Ruby Conference Belarus 2019 Apr Jets Ruby Serverless FrameworkTung Nguyen
 
AWS Summit Santa Slara 2019 Mar ECS
AWS Summit Santa Slara 2019 Mar ECSAWS Summit Santa Slara 2019 Mar ECS
AWS Summit Santa Slara 2019 Mar ECSTung Nguyen
 
Serverless Cron Jobs with Ruby on Jets
Serverless Cron Jobs with Ruby on JetsServerless Cron Jobs with Ruby on Jets
Serverless Cron Jobs with Ruby on JetsTung Nguyen
 
Jets: A Ruby Serverless Framework
Jets: A Ruby Serverless FrameworkJets: A Ruby Serverless Framework
Jets: A Ruby Serverless FrameworkTung Nguyen
 
Ruby Support for AWS Lambda at Native Speed with Jets
Ruby Support for AWS Lambda at Native Speed with JetsRuby Support for AWS Lambda at Native Speed with Jets
Ruby Support for AWS Lambda at Native Speed with JetsTung Nguyen
 
Getting Started with Amazon ECS: Run Docker Containers on AWS
Getting Started with Amazon ECS: Run Docker Containers on AWSGetting Started with Amazon ECS: Run Docker Containers on AWS
Getting Started with Amazon ECS: Run Docker Containers on AWSTung Nguyen
 

Mehr von Tung Nguyen (11)

re:Invent 2019 Highly Available ECS Spot Architecture: Save 50%-90%
re:Invent 2019 Highly Available ECS Spot Architecture: Save 50%-90%re:Invent 2019 Highly Available ECS Spot Architecture: Save 50%-90%
re:Invent 2019 Highly Available ECS Spot Architecture: Save 50%-90%
 
Jets: The Ruby Serverless Framework Nashville Tennessee 2019 August
Jets: The Ruby Serverless Framework Nashville Tennessee 2019 AugustJets: The Ruby Serverless Framework Nashville Tennessee 2019 August
Jets: The Ruby Serverless Framework Nashville Tennessee 2019 August
 
Jets: The Ruby Serverless Framework Balkan Ruby Bulgaria 2019 May
Jets: The Ruby Serverless Framework Balkan Ruby Bulgaria 2019 MayJets: The Ruby Serverless Framework Balkan Ruby Bulgaria 2019 May
Jets: The Ruby Serverless Framework Balkan Ruby Bulgaria 2019 May
 
Jets: The Ruby Serverless Framework Ruby Kaigi Japan 2019 April
Jets: The Ruby Serverless Framework Ruby Kaigi Japan 2019 AprilJets: The Ruby Serverless Framework Ruby Kaigi Japan 2019 April
Jets: The Ruby Serverless Framework Ruby Kaigi Japan 2019 April
 
Getting Started with ECS: An Easy Way to Run Docker Containers - AWS Summit A...
Getting Started with ECS: An Easy Way to Run Docker Containers - AWS Summit A...Getting Started with ECS: An Easy Way to Run Docker Containers - AWS Summit A...
Getting Started with ECS: An Easy Way to Run Docker Containers - AWS Summit A...
 
Ruby Conference Belarus 2019 Apr Jets Ruby Serverless Framework
Ruby Conference Belarus 2019 Apr Jets Ruby Serverless FrameworkRuby Conference Belarus 2019 Apr Jets Ruby Serverless Framework
Ruby Conference Belarus 2019 Apr Jets Ruby Serverless Framework
 
AWS Summit Santa Slara 2019 Mar ECS
AWS Summit Santa Slara 2019 Mar ECSAWS Summit Santa Slara 2019 Mar ECS
AWS Summit Santa Slara 2019 Mar ECS
 
Serverless Cron Jobs with Ruby on Jets
Serverless Cron Jobs with Ruby on JetsServerless Cron Jobs with Ruby on Jets
Serverless Cron Jobs with Ruby on Jets
 
Jets: A Ruby Serverless Framework
Jets: A Ruby Serverless FrameworkJets: A Ruby Serverless Framework
Jets: A Ruby Serverless Framework
 
Ruby Support for AWS Lambda at Native Speed with Jets
Ruby Support for AWS Lambda at Native Speed with JetsRuby Support for AWS Lambda at Native Speed with Jets
Ruby Support for AWS Lambda at Native Speed with Jets
 
Getting Started with Amazon ECS: Run Docker Containers on AWS
Getting Started with Amazon ECS: Run Docker Containers on AWSGetting Started with Amazon ECS: Run Docker Containers on AWS
Getting Started with Amazon ECS: Run Docker Containers on AWS
 

Kürzlich hochgeladen

Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxhumanexperienceaaa
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...ranjana rawat
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).pptssuser5c9d4b1
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 

Kürzlich hochgeladen (20)

Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 

Automate Docker Deployments to AWS ECS with UFO

  • 2. About Me I’ve done a little bit of everything. Both dev and ops. @tongueroo - Twitter. https://medium.com/@tongueroo - Blog. tongueroo.com - Personal Site.
  • 3. lono - CloudFormation template generator. jack - Manage ElasticBeanstalk environments. thor_template - used this to generate this tool. ufo - ship docker images to ecs. What this talk is about. These tools are in Ruby. More: http://tongueroo.com/projects/ Other Tools
  • 4. Why? Wanted get my hands dirty with ECS. Wanted more control over the ECS task definition. Wanted to automated the building of the docker image as part of building task definition. Ending up using it on my side projects.
  • 5. ECS Introduction - Terms Task definition - blueprint for docker container. Task - Actual running container. Service - Long running tasks. Cluster - Logic group of EC2 Container instances. Container Instance - EC2 instance that is part of an ECS Cluster.
  • 7. Steps for Deploying on ECS 1.Build and push docker image 2.Build and register task definition 3.Update the ECS service (create the service if needed)
  • 8. Google Search: “deploying to ecs” silinternational/ecs-deploy - pulls down existing task definition. CircleCI deploy.sh example - nice and simple easy to build from. Empire - heroku like opensource SaaS from Remind engineering. A little more than I need but cool project. Programmer Virtue #1: Laziness -> Research
  • 9. Wanted more control over the task definition template. Would be nice if the task definition could be reused for common and similar processes: web, clock, worker. More Control
  • 10. Task Definition Similarities $ cat ufo/output/hi-web.json { "family": "hi-web", "containerDefinitions": [ { "name": "web", "image": "tongueroo/hi:ufo-2016-12-04T17-54- 23-2d1634d", "cpu": 128, "memoryReservation": 256, "portMappings": [ { "containerPort": "3000", "protocol": "tcp" } ], "command": [ "bin/web" ], "environment": [ { "name": "ADMIN_PASSWORD", "value": "secret" } ], "essential": true $ cat ufo/output/hi-worker.json { "family": "hi-worker", "containerDefinitions": [ { "name": "worker", "image": "tongueroo/hi:ufo-2016-12-04T17-54- 23-2d1634d", "cpu": 128, "memoryReservation": 256, "command": [ "bin/worker" ], "environment": [ { "name": "ADMIN_PASSWORD", "value": "secret" } ], "essential": true } ] }$
  • 11. UFO Template DSL UFO will use a ERB template to generate the task definition for all the processes you need: web, clock, worker, etc. Allows sharing of code and settings. Let’s see what it looks like.
  • 12. UFO Task Definition Template DSL $ cat ufo/templates/main.json.erb { "family": "<%= @family %>", "containerDefinitions": [ { "name": "<%= @name %>", "image": "<%= @image %>", "cpu": <%= @cpu %>, <% if @memory %> "memory": <%= @memory %>, <% end %> <% if @memory_reservation %> "memoryReservation": <%= @memory_reservation %>, <% end %> <% if @container_port %> "portMappings": [ { "containerPort": "<%= @container_port %>", "protocol": "tcp" } ], <% end %> "command": <%= @command.to_json %>, <% if @environment %> $ cat ufo/task_definitions.rb common = { image: helper.full_image_name, cpu: 128, memory_reservation: 256, environment: env_file(".env") } task_definition "hi-web" do source "main" variables(common.dup.deep_merge( family: task_definition_name, name: "web", container_port: helper.dockerfile_port, command: ["bin/web"] )) end task_definition "hi-worker" do source "main" variables(common.dup.deep_merge( family: task_definition_name, name: "worker", command: ["bin/worker"] )) end
  • 13. UFO Task Definition Output $ cat ufo/output/hi-web.json { "family": "hi-web", "containerDefinitions": [ { "name": "web", "image": "tongueroo/hi:ufo-2016-12-04T17-54- 23-2d1634d", "cpu": 128, "memoryReservation": 256, "portMappings": [ { "containerPort": "3000", "protocol": "tcp" } ], "command": [ "bin/web" ], "environment": [ { "name": "ADMIN_PASSWORD", "value": "secret" } ], "essential": true $ cat ufo/output/hi-worker.json { "family": "hi-worker", "containerDefinitions": [ { "name": "worker", "image": "tongueroo/hi:ufo-2016-12-04T17-54- 23-2d1634d", "cpu": 128, "memoryReservation": 256, "command": [ "bin/worker" ], "environment": [ { "name": "ADMIN_PASSWORD", "value": "secret" } ], "essential": true } ] }$
  • 14. ufo ship: whole point of this tool NOTE: The ECS Cluster and a Container Instance must already exist. I created Container Instances with the lono tool. 1. Build and push docker image 2. Build and register task definition 3. Update the ECS service (create the service automatically if needed)
  • 16. What Happened Review Summary ufo init - generates the skeleton ufo files. Mainly ufo/task_definitons.rb and ufo/templates/main.json.erb - most configurations and changes go in here. ufo/settings.yml - is nice to know about a useful setting in here. bin/deploy - wrapper script.
  • 17. In ufo/task_definitions.rb there are some helper methods. helper.full_image_name - this is the generated docker image name. helper.dockerfile_port - parsed from the Dockerfile. env_file - useful helper method to translate a env list to the json formatted list for an ECS Task definition. Review tasks_definitions.rb Helpers
  • 18. ufo docker build - only build the docker image ufo tasks build - only build the task definitions ufo scale hi-web 1 - scale up and down tasks Misc ufo commands
  • 19. THE END Hacker Noon Blog Post - Ufo—Easily Build Docker Images and Ship Containers to AWS ECS Setting up CI with UFO, ECS, and CircleCI GitHub - https://github.com/tongueroo/ufo Slideshare - http://www.slideshare.net/tongueroo/ufo- ship-for-aws-ecs-70885296 tongueroo@gmail.com - feel free to contact me

Hinweis der Redaktion

  1. Time Machine. Infrastructure is Code Philosophy, Culture, Mindset Devs should be able to spin up the cluster themselves w/o any ops involvement. Everyone wants their own internal PasS, their own heroku. That's still the ultimate goal.