Today’s modern infrastructure allows product teams to take full advantage of “infrastructure-as-code” and deliver value to their customers faster through a seamless & smart delivery pipeline.This delivery pipeline is built using AWS and 3rd party tools such as CloudFormation, Lambda, Terraform, Jenkins, Beanstalk, CodeDeploy, Ansible, and Docker. In the presentation we will walk you through the best practices of combining all the above into a “smart-delivery-pipeline” for your team. By Oron Adam, Emind CTO
2. @oronoa
Started as a Developer
CTO of Emind Cloud Experts
Love to code AWS infrastructure and other things as well ...
About Myself
3.
4.
5. Key Challenges for Ops of Agile Product Teams
● Dev, Staging & Production Parity
● Let Dev experiment and fail fast
● Innovate while reducing risk
● Continuous uninterrupted delivery of service (and new features)
● Feedback loops, automation, metrics and goals
6. Dev/Prod Parity
● Keep development staging and production as identical as possible
● Backing services same across environments
8. Automation Critical
Needs to be 100% reproducible
Configure Server and SW automatically
Be able test success / failure of server startup
9.
10. AWS CloudFormation
● Declarative Language
● Integrates with git or any VC system
● Simple JSON Format
● Supports Templates and Stacks
● Supports All AWS resource types
● Part of the CI/CD Pipeline
16. CloudFormation app deployment best practices
Use AWS::CloudFormation::Init
Use IAM roles to securely download software and data
Use Amazon CloudWatch logs for debugging
Use cfn-hup for updates
Use custom AMIs to minimize application boot times
33. Management VPC peered to all other VPCs
Per Customer VPC
Need to be able to quickly setup new accounts
Per Environment Application Stack
for each dev, staging, production envs
Services Oriented Architecture (SOA) in the
insurance industry.
34.
35. Cloud Formation
management VPC
Access VPC
VPC for dev, staging, prod
Lambda - CIDR and subnet calculations
Peering of VPCs requires inter stack
communication via outputs
37. def get_subnets_from_cidr(event, context):
"""
Calculates subnets for a given CIDR and returns the result as a Custom Resource
Response Object to CloudFormation.
Arguments (encapsulated in the 'event' argument by CloudFormation):
cidr - the CIDR from which to extract the subnets in slash notation ('172.16.0.0
/16').
number_of_subnets - the number of subnets to extract. Must be at least 1.
subnet_size - the number of hosts in each extracted subnet. Must be a power of 2.
start_from - return the desired number of subnets starting at this subnet number.
Optional.
Example:
event = {
...
"ResourceProperties": {
"cidr": "172.16.0.0/16",
"number_of_subnets": "4",
"subnet_size": "256",
"start_from": "3"
}
}
result = {
"Id0": "172.16.2.0/24",
"Id1": "172.16.3.0/24",
"Id2": "172.16.4.0/24",
41. What packer fixes?
Images are produced from templates
Images are maintainable
Images are cross cloud provider
Automated, Repeatable and Fast
Can also produce Vagrant Boxes for Dev
42. packer use cases
Continuous Delivery
Dev / Prod Parity
Fast scaling out with non vanilla images
Demo images for multiple cloud providers
44. packer & CloudFormation together
Pre bake images with packer form cmd line
Can be easily initiated from CI server
parameterize AMI ids and give to CF stack run
45. packer & CloudFormation together
AMI is built at pack time, not scale time
Can still use CloudInit to build, just happens at pack-time, not scale
time
No reliance on any external services to bring another server online
Updated AMI is a command-line statement away
Can pack local VMs using identical code
47. Using TerraForm for agile scrum environments
Env is created for scum duration
Env destroyed when done
48. TerraForm
Execution Plans - see what’s going to happen
Relationships & Dependencies - reference other resources
State - get resources to desired state
Multiple Providers - on many clouds