PuTTY
$ ssh ubuntu@<publicDnsName> $ sudo apt-get update $ sudo apt-get install lamp-server^ \ php5-mcrypt php5-curl php5-gd php5-intl php5-xsl \ mysql-server-5.6 redis-server \ varnish $ sudo php5enmod mcrypt $ sudo a2enmod rewrite ^C exit $ rsync –av . ubuntu@<publicDnsName>:/var/www/html
Database
Servers
Cache
Load Balancer Firewall
DNS
Network
Streams
Queues Monitoring Logging Pubsub
Deployment Storage CDN Email WAF
VCS
Workflow
Identity
Region: eu-west-1 (Ireland)
Availability Zone
eu-west-1a
Availability Zone
eu-west-1c
Availability Zone
eu-west-1b
Region: eu-west-1 (Ireland)
VPC
Availability Zone
eu-west-1a
Availability Zone
eu-west-1c
Availability Zone
eu-west-1b
Public Subnet Public Subnet Public Subnet
Private Subnet Private Subnet Private Subnet
Auto Scaling group
Auto Scaling group
Elastic Load
Balancer
Auto Scaling group Auto Scaling group
Elastic Load
Balancer
Public subnets
Private subnets
Auto Scaling group
Auto Scaling group
Elastic Load
Balancer
Auto Scaling group Auto Scaling group
Elastic Load
Balancer
What can I use for “media/” when
deploying Magento to multiple
servers?
“I’ll just
use rsync
on cron”
Are you
on AWS?
Is EFS
out yet? AWS EFS
Are you willing
to deal with
NFS/
GlusterFS?
NFS/
GlusterFS
Is this only
about
product
images?
only a few
files?
Magento’s
DB + get.php
Aoe_AmazonCDN
(S3 + CloudFront)
S3FS +
CloudFront
nope! Seriously: no!
no
yes
yes no yes
no
yes
no
yes
no
and/or are you willing to update
all other module’s code to not
access the file system directly but
use a different API instead?
…or other modules that
abstract from the local
filesystem. “Flysystem” is a
great foundation for that
Auto Scaling group
Auto Scaling group
Elastic Load
Balancer
Auto Scaling group Auto Scaling group
Elastic Load
Balancer
/i(m)ˈmyo͞odəb(ə)l/
adjective
unchanging over time or unable to be changed.
“disposable” “ephemeral”
Private subnets
Public subnets
ElastiCache (Redis)
with replication groups
for cache and sessions
RDS (multi-az) with
DB subnet group
Bastion
server
s3: media
storage*
Route 53: DNS
configuration CloudFront
distribution
SSL
Certificates
Security group for Varnish servers
Security group for Magento servers
Security group for Load Balancer
Static Resources
Build
Auto Scaling group
Auto Scaling group
Elastic Load
Balancer
Auto-
Scaling
Group
Launch
Configurati
on
Scaling
Policy
Auto Scaling group Auto Scaling group
Urls
Database Settings
Payment Provider Configuration Feature
Flags…
Everything that’s different between two
environments
“Chef vs. Puppet?”
http://fbrnc.net/blog/2015/11/
how-to-provision-an-ec2-instance
“…Ansible!” “BASH!”
aoepeople/stackformation
command-line tool (Symfony console, uses
AWS SDK for PHP)
integrates nicely into your CI (Jenknis,…)
blueprints: - stackname: 'magento-{env:BUILD}' template: 'magento.template' stackPolicy: 'policy.json' OnFailure: 'DO_NOTHING' parameters: Build: '{env:BUILD}' KeyPair: '{var:KeyPair}' VPC: '{resource:setupstack:VPC}' Subnet: '{resource:setupstack:Subnet}' InstanceSg: '{resource:setupstack:InstanceSg}' InstanceProfile: '{output:setupstack:InstanceProfile}' BootAmi: 'ami-06116566' tags: Environment: 'prod' Build: '{env:BUILD}'
enforce “immutability” by denying updates!
aoepeople/awsinspector
command-line tool (Symfony console, uses
AWS SDK for PHP)
Domain models for PHP
$repository = new \AwsInspector\Model\Elb\Repository(); $dns = $repository->findElbsByTags([ 'Environment' => 'deploy', 'Build' => 554, 'Type' => 'Frontend’ ])->getFirst()->getDNSName();
> bin/awsinspector.php ec2:ssh -t Environment:prod –c Type –c Build
filter by tag
Please select an instance [0] i-1033ed9b (Type: Frontend; Environment: prod; Build: 477) [1] i-4ff36ec8 (Type: Backend; Environment: prod ; Build: 477) [2] i-5ab4322b (Type: Worker; Environment: prod; Build: 477) [3] i-705ad42f (Type: Worker; Environment: prod; Build: 476) >
• will take jump hosts into account (ProxyCommand)
• auto-detects your local
(encrypted) private keys
• multiplexed ssh connections
• run commands directly