What You'll Miss On AWS
& How To Find It Again
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/1854640/StuRents_Logo_Primary.png)
@M1ke
Mike Lehan
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4081559/Road_Sign_Lost.jpg)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4081567/opendoor.jpg)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4081698/ohrrn.jpg)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4081702/ce95bef30f0fe1b77135991cac5dfb3c402688c5d18f0cfa90d467ab901ca9c2.jpg)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4081706/gcp.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4081707/msazurelogo.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4081710/45283063.jpg)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4081711/what-did-you-say.jpg)
S3: Simple Storage Service
EC2: Elastic Compute Cloud
RDS: Relational Database Service
EBS: Elastic Block Store
EFS: Elastic File System
ELB: Elastic Load Balancer
First, Acronyms!
Cheap file storage
Servers!
No more my.cnf!
Hard disks!
Networked HDD
You'll see!
What you'll miss | How we solve it | |
---|---|---|
1 | Your server actually being there | Launch servers in multiple availability zones |
2 | Domain mapping to an IP | Load balancing with a Route 53 alias |
3 | Users having consistent sessions | Enable sticky sessions |
4 | Making server config changes | Auto scaling groups & automated machine imaging |
5 | Using the file system | Elastic File System |
6 | SSH access to your server | Elastic IP and Lambda functions |
7 | Files uploading quickly | Multi-stage deployments |
8 | Sub 1s PHP execution times | Zend Opcache |
9 | Cron! | Scheduled Lambda functions |
tl;dr
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4081809/download.jpg)
Is this really the best way of doing things?
You'll miss: your server actually being available
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4081779/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4081765/Global_Infrastructure_v25_7.19.17.png)
eu-west-1 (Dublin) or eu-west-2 (London)
- Launch servers in multiple availability zones
- If using RDS, choose the "Multi AZ" option
- Use an "auto scaling group" to guarantee servers in a specified number of AZs
- No need to worry about S3, EFS or Lambda - synced across AZs automatically
You'll miss: domains mapping to IPs
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4081794/server_spaghetti_1.jpg)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4081800/load_balancer.png)
- You don't need to worry about its AZ
- It can target a group of instances
- Even checks if an instance can receive HTTP connections
- Called a "balancer" but really just directs traffic randomly
- Because you obviously all use TLS, you'll need to give the Load Balancer your private key
You'll miss: users having consistent sessions
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4081811/maxresdefault.jpg)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4081817/Selection_001.png)
Sticky sessions!
You'll miss: making server config changes on the fly
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4089793/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4089797/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4094473/pasted-from-clipboard.png)
Behold the "master" instance!
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4094486/pasted-from-clipboard.png)
Be lazy; use Lambda!
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4094491/pasted-from-clipboard.png)
- Check for AMIs in our account with a specific "tag"
- If there are more than 1, delete all but the newest - helps keep our S3 costs down and our account tidy
- Get the current launch configuration of our autoscaling group - we can assume this works
- Replace the variables in the data for the AMI ID and snapshot ID
- Create a new launch configuration
- Apply the launch configuration to the autoscaling group
Next, hacks and magic!
Autoscaling lets us make scheduled actions
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4094500/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4094504/pasted-from-clipboard.png)
It also lets us choose how it terminates instances
In summary
- Edit your master server
- Switch off your master server
- Make an image of it
- Create a launch configuration with that image
- Set your autoscaling group to use the new launch configuration
- Cycle out your old instances
- ?
- Profit
You'll miss: using the file system
How are there are no memes about file systems?
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4094552/overview-flow.png)
This bit
Connect from any AZ
Works as a network mount
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4094563/Selection_006.png)
EFS is also "limitless"
The "E" stands for exabyte:
1,000,000,000,000,000,000 bytes
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4094587/Selection_007.png)
You'll miss: SSH access to your server
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4094644/Selection_008.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4094663/2XNdewVsgellO3x8-01890.png)
Elastic IP
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4094674/Selection_009.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4094696/Selection_010.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4094699/Selection_011.png)
.ssh/config
You'll miss: files uploading quickly
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4094704/Selection_012.png)
EFS slow down means your app files might end up inconsistent
If your app can't tolerate this you need to use atomic deployments
- Deploy your application to a writable directory on whichever server you have an elastic IP attached to
- Trigger a process on the server to copy your files to a named release folder (e.g. timestamp) on EFS
- Repoint a symlink to which your web server config points as the application root
Many deployment programs that use a remote agent (e.g. capistrano) already use this technique. We rolled our own in bash
You'll miss: PHP scripts executing in less than a second
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4094760/Selection_013.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4094784/OPcache.png)
Seriously, can we not have cool logos for PHP mods?
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4094791/Selection_014.png)
/etc/php/7.(0|1)/mods-available/opcache.ini
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4094794/Selection_015.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4094798/Selection_016.png)
Easy right?
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4094806/Selection_017.png)
github.com/rlerdorf/opcache-status
You'll miss: crontab for scheduling jobs
Why did I commit to this meme thing?
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4094855/Selection_018.png)
Logging is fun...
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4094966/hqdefault.jpg)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4094973/6d191a059fb1cc481c376476823c3785--exploding-kittens.jpg)
Sounds like you'll miss a lot...
What do you gain?
- Ability to offer "always up" web services to your company or clients without building your own data centre(s)
- A growing standard for how distributed applications behave
- Stupidly cheap storage on S3 and processing on Lambda
- Bulletproof backups
- Multiple options for data sovereignty
AWS might appear hard, but it's easier than finding a relevant meme for each item in a list of infrastructure problems!
Liked this talk?
Let me know!
@m1ke on Twitter
github.com/m1ke
Enjoy the rest of PHPNW17
Please leave feedback
https://joind.in/talk/0e908
![](https://s3.amazonaws.com/media-p.slid.es/uploads/57842/images/4081805/1106514-cool_story_bro_super.jpg)
What You'll Miss on AWS
By Mike Lehan
What You'll Miss on AWS
Moving from a traditional server environment to AWS can be scary and confusing; here are some ways to make it better. Presented at PHPNW17
- 2,716