Running and Scaling Magento on AWS
- 7. 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
- 23. Auto Scaling group
Auto Scaling group
Elastic Load
Balancer
Auto Scaling group Auto Scaling group
Elastic Load
Balancer
Public subnets
Private subnets
- 26. Auto Scaling group
Auto Scaling group
Elastic Load
Balancer
Auto Scaling group Auto Scaling group
Elastic Load
Balancer
- 29. 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
yesnoyes
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
- 44. 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
- 45. Build
Auto Scaling group
Auto Scaling group
Elastic Load
Balancer
Auto-
Scaling
Group
Launch
Configurati
on
Scaling
Policy
Auto Scaling group Auto Scaling group
- 57. 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!
- 63. $repository = new AwsInspectorModelElbRepository();
$dns = $repository->findElbsByTags([
'Environment' => 'deploy',
'Build' => 554,
'Type' => 'Frontend’
])->getFirst()->getDNSName();
- 64. > 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