Get certified in Developer Operations on AWS
Overview
This tutorial contains my notes about getting certified as a AWS Certified DevOps Engineer - Professional – able to setup and manage continuous integration and deployment in the AWS cloud – after paying $300 USD to write out 80 essay (not multiple-choice) questions in 170 minutes (3 hours with no breaks). That’s 2.1 seconds per essay question. Those who fail the exam must wait 30 days before being allowed to retake the exam (at additional cost), and only 3 times in a 12 month period.
NOTE: Content here are my personal opinions, and not intended to represent any employer (past or present). “PROTIP:” here highlight information I haven’t seen elsewhere on the internet because it is hard-won, little-know but significant facts based on my personal research and experience.
The previous pre-requisite is passing either one:
- https://aws.amazon.com/certification/certified-sysops-admin-associate/
- https://aws.amazon.com/certification/certified-developer-associate/
References
AWS Artifact competes with DockerHub, JFrog Artifactory, etc. to hold Docker containers and other artifacts built for loadeding into Kubernetes and other run-time systems.
From AWS YouTube playlist:
- https://www.youtube.com/playlist?list=PLhr1KZpdzukeH9VMPbNHMCXl_NrVc1JGe
- https://www.youtube.com/playlist?list=PLhr1KZpdzuke5pqzTvI2ZxwP8-NwLACuU
- https://www.youtube.com/playlist?list=PLhr1KZpdzukeMbjRqGswHX38DCqOHZ5GA
-
https://www.youtube.com/playlist?list=PLhr1KZpdzukfVW6NrpDzdT6Sej0p5POkN
- http://cantrill.io
- http://ozaws.com
- https://serverlesscode.com/
- https://paulwakeford.info/
- https://aws.amazon.com/blogs/aws/
- https://www.awsarchitectureblog.com
- http://blogs.aws.amazon.com/application-management
- http://blogs.aws.amazon.com/security/
- https://aws.amazon.com/blogs/compute/
- https://aws.amazon.com/whitepapers/
https://aws.amazon.com/documentation/
-
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html
-
AWS Certified DevOps Engineer - Professional 6-hour video by Nick Triantafillou covers:
- Core Concepts
- CI/CD Automation
- Monitoring/Metrics/Logging
- Security/Governance/Validation
- High Availability and Elasticity
- Operations
https://wilsonmar.github.io/build-load-balanced-servers-in-AWS-EC2/
Projects on AWS: Set Up a CI/CD Pipeline on AWS
From https://docs.aws.amazon.com/codepipeline/latest/userguide/tutorials.html
A pipeline helps you automate steps in your software delivery process, such as initiating automatic builds and then deploying to Amazon EC2 instances. You will use AWS CodePipeline, a service that builds, tests, and deploys your code every time there is a code change, based on the release process models you define. Use CodePipeline to orchestrate each step in your release process. As part of your setup, you will plug other AWS services into CodePipeline to complete your software delivery pipeline. This guide will show you how to create a very simple pipeline that pulls code from a source repository and automatically deploys it to an Amazon EC2 instance.
What is DevOps (DevSecOps)?
Amazon defines “DevOps is the combination of cultural philosophies, practices, and tools that increases an organization’s ability to deliver applications and services at high velocity.”
CodeCommit, CodeBuild, CodePipeline, CodeDeploy
CodeCommit setup
- AWS CodeCommit User Guide
- Create and Clone an AWS CodeCommit Repository video hands-on course.
AWS CodeCommit competes with GitHub, GitLab, BitBucket, and other cloud-based text code repositories.
Repositories in AWS CodeCommit have a URL that contains a region, such as:
https://git-codecommit.us-east-1.amazonaws.com/v1/repos/MyRepo
CodeBuild Setup
CodeDeploy Setup instances
- In IAM Service, create Role “codedeploy”.
- Create CDInstanceRole
-
In Compute EC2 service, launch Amazon Linux, t2.micro, 2 instances, using the role created above. In Advanced Details, paste script from https://gist.github.com/mikepfeiffer/4d9386afdcceaf29493a
EC2 UserData script to install CodeDeploy agent:
#!/bin/bash yum install -y aws-cli cd /home/ec2-user/ aws s3 cp 's3://aws-codedeploy-us-east-1/latest/codedeploy-agent.noarch.rpm' . --region us-east-1 yum -y install codedeploy-agent.noarch.rpm
CUSTOMIZE folder, region mentionedtwice.
- Tag instances with name “Dev” for Development.
- Add a Security Group Role for HTTP. No SSH.
AWS CodeDeploy Setup
- Got to AWS CodeDeploy service, Get Started Now.
- Custom deployment.
- Specify an Application Name and Deployment Group Name according to your organization’s naming standards.
- Select Tag Type “Amazon EC2” value “Dev” specified for 2 instances in a step above.
- Deployment Config - AllAtOnce (instead of Half at a time).
- No Triggers.
-
Select a Service Role ARN defined in a prior step. Create Application.
The AWS Console provides code to deploy from a S3 bucket.
AWS CodePipeline
- Go to AWS CodePipeline service, Get Started.
- Specify a Pipeline name according to your organization’s naming standards. (“Pipeline1”)
- Select Source Provider: GitHub (NOT Amazon S3). Click Connect to GitHub.
- Select a Repository and Branch from the GitHub account authenticated.
- Select Deployment provider AWS CodeDeploy (NOT AWS Elastic Beanstalk).
- Supply AWS CodeDeploy Application Name and Deployment group from earlier.
- Do not define Build Stage (until we have a build).
- Create Service Role using default name “AWS-CodePipeline-Service”. View Policy Document to review Actions allowed the role:
- Review Pipeline summary.
- Cleanup: Delete the pipeline you just created.
PROTIP: Each pipeline costs about $1 per month, and charges only if a deployment occurs.
View app deployed
-
In EC2, copy the Public DNS address, such as:
"ec2-11-222-177-132-us-west-2-compute.amazonaws.com
-
Paste URL in an internet browser.
It should respond with “Congratualations”.
Make Change
- Commit.
- Detect a change.
-
View app deployed again.
- Create a Deployment Group or Autoscaling Group
-
CodePipeline
-
appspec.yml file in the root folder in source code repo
version: 0.0 os: linux files: - source: /index.html destination: /var/www/html/ hooks: BeforeInstall: - location: scripts/install_dependencies timeout: 300 runas: root - location: scripts/start_server timeout: 300 runas: root ApplicationStop: - location: scripts/stop_server timeout: 300 runas: root
-
For sample application, it’s just a single index.html file containing CSS, no JavaScript.
https://github.com/mikepfeiffer/aws-codedeploy-linux/blob/master/index.html
-
Install dependencies
#!/bin/bash yum install -y httpd
-
Start server
#!/bin/bash service httpd start
-
Stop server:
#!/bin/bash isExistApp = `pgrep httpd` if [[ -n $isExistApp ]]; then service httpd stop fi
using AWS Code Services
CodeDeploy agent in EC2 Deploy Group
-
Amazon Route 53 globomantics.com
-
https://github.com/mikepfeiffer/PowerShell
Snapshot AMIs
Building a server from installers in S3 can be time-consuming because it take so much I/O and network bandwidth.
Michael Tripoli & Karate Vick at Netflix open-sourced on GitHub their Python tool called “Animator” for creating EBS-backed AMIs. The tool create a Base AMI by taking a snapshot of the root volume and making it available as an EBS volume that can be used to launch an EC2 instance.
It’s described on Medium and in this blog from 2013.
They said “We knew that application startup latency would be very important, especially during scale-up operations.”
This is simpler than Packer from HashiCorp.
Learning Resources
Australian Nick Triantafillou (@xelfer) for $99 provides 6 hours of videos covering 60 lessons in his ACloud.guru course.
Mike Pfeiffer created at Pluralsight a series of video courses, one for each “domain” of the AWS Certified DevOps Engineer Professional exam:
-
Continuous Delivery and Process Automation 4h 16m Apr 28, 2016
-
Monitoring, Metrics, and Logging 2h 46m June 2, 2016
- CloudWatch
- CloudTrail
-
Security, Governance, and Validation 2h 11m July 26, 2016
- Delegation & Federation
- Corporate Identity Federation
- Web Identity Federation
-
High Availability and Elasticity 2h 51m Sept 26, 2016
- Auto Scaling
- GSI/LSI
- RDS
- Dynamo
- Aurora
- SQS
- Kinesis
Justin Manga (@jmenga, pseudo.co.de) in Pluralsight video course Continuous Delivery using Docker and Ansible shows learners how to create a Python app, then Jenkins 2 Pipeline plugin in a container using Cloud Formation files. deploy to a EC2 Container Services holding Debian instances.
Since ECS has Group of 497:
ARG DOCKER_GID=497 RUN groupadd -g ${DOCKER_GID:-497} docker ARG DOCKER_ENGINE=1.10.2 ARG DOCKER_COMPOSE=1.6.2
- http://blog.serverbooter.com/blog/2013/10/24/simple-clouformation-with-multiple-aws-accounts/
Boto Python
The README page says “Boto3 is the Amazon Web Services (AWS) Software Development Kit (SDK) for Python, which allows Python developers to write software that makes use of services like Amazon S3 and Amazon EC2.”
NOTE: Boto 3 is built on top of Botocore used by the AWS CLI:
- Sessions
- Clients: low level service connections
Boto 3 consists of these major features:
- Resources: a high level, object oriented interface
- Collections: a tool to iterate and manipulate groups of resources
- Paginators: automatic paging of responses
- Waiters: a way to block until a certain state has been reached
References
Amazon’s own DevOps Engineering on AWS 3-day classroom course covers:
- Use the principal concepts and practices behind the DevOps methodology
- Design and implement an infrastructure on AWS that supports one or more DevOps development projects
- Use AWS CloudFormation and AWS OpsWorks to deploy the infrastructure necessary to create development, test, and production environments for a software development project
- Use AWS CodeCommit and AWS CodeBuild to understand the array of options for enabling a continuous integration (CI) environment on AWS
- Use AWS CodePipeline to design and implement a continuous integration and continuous delivery (CI/CD) pipeline on AWS
- Use AWS CodeStar to manage all software development activities in one place
-
Implement several common continuous deployment (CD) use cases using AWS technologies, including blue/green deployment and A/B testing
- Distinguish between the array of application deployment technologies available on AWS, including AWS CodeDeploy, AWS OpsWorks, AWS Elastic Beanstalk, Amazon Elastic Container Service (Amazon ECS), and Amazon Elastic Container Registry (Amazon ECR), and decide which technology best fits a given scenario
- Use Amazon EC2 Systems Manager for patch management
- Leverage automated testing in different stages of a CI/CD pipeline
- Fine-tune the applications you deliver on AWS for high performance, and use AWS tools and technologies to monitor your application and environment for potential issues
More on DevOps
This is one of a series on DevOps:
- DevOps_2.0
- ci-cd (Continuous Integration and Continuous Delivery)
- User Stories for DevOps
- Git and GitHub vs File Archival
- Git Commands and Statuses
- Git Commit, Tag, Push
- Git Utilities
- Data Security GitHub
- GitHub API
- Choices for DevOps Technologies
- Pulumi Infrastructure as Code (IaC)
- Java DevOps Workflow
- AWS DevOps (CodeCommit, CodePipeline, CodeDeploy)
- AWS server deployment options
- Cloud services comparisons (across vendors)
- Cloud regions (across vendors)
- Azure Cloud Onramp (Subscriptions, Portal GUI, CLI)
- Azure Certifications
- Azure Cloud Powershell
- Bash Windows using Microsoft’s WSL (Windows Subsystem for Linux)
- Azure Networking
- Azure Storage
- Azure Compute
- Digital Ocean
- Packer automation to build Vagrant images
- Terraform multi-cloud provisioning automation
-
Hashicorp Vault and Consul to generate and hold secrets
- Powershell Ecosystem
- Powershell on MacOS
- Jenkins Server Setup
- Jenkins Plug-ins
- Jenkins Freestyle jobs
- Docker (Glossary, Ecosystem, Certification)
- Make Makefile for Docker
- Docker Setup and run Bash shell script
- Bash coding
- Docker Setup
- Dockerize apps
- Ansible
- Kubernetes Operators
- Threat Modeling
- API Management Microsoft
- Scenarios for load
- Chaos Engineering
More on Amazon
This is one of a series on Amazon:
- AWS Cloud Services Comparisons
- AWS Well-Architected Cloud
- AWS Cloud Services
- AWS IAM
- AWS CLI
- AWS On-boarding (GUI, CLI, API)
- AWS Security
- AWS Data Tools
- AWS DevOps (CodeCommit, CodePipeline, CodeDeploy)
- AWS server deployment options
- AWS CDK
- Build load-balanced servers in AWS EC2
- AWS Networking
- AWS Xray
- IoT on AWS
- AWS Lambda
- AWS Lambda