Using Athena to Query ALB Logs

One of the more interesting AWS Big Data Services is Amazon Athena. Athena can process S3 data in a few seconds. One of the ways I like using it is to look for patterns in ALB access logs.

AWS provides a detailed instruction on how to setup Athena on how to setup ALB access logs. I’m not going to recap the configuration in this blog article, but share 3 of my favorite queries.

What is the most visited page by the client and total traffic on my website:

SELECT sum(received_bytes) as total_received, sum(sent_bytes) as total_sent, client_ip, 
count(client_ip) as client_requests, request_url  
FROM alb_logs 
GROUP BY client_ip, request_url  
ORDER BY total_sent  desc;

How long does it take to process requests on average?

SELECT sum(request_processing_time) as request_pt, sum(target_processing_time) as target_pt,
sum (response_processing_time) respone_pt, 
sum(request_processing_time + target_processing_time + response_processing_time) as total_pt, 
count(request_processing_time) as total_requests,
sum(request_processing_time + target_processing_time + response_processing_time) / count(request_processing_time) as avg_pt,
request_url, target_ip
FROM alb_logs WHERE target_ip <> ''
GROUP BY request_url, target_ip 
HAVING COUNT (request_processing_time) > 4 
ORDER BY avg_pt desc;

This last one is looking for requests the site doesn’t process. It’s usually some person trying to find some vulnerable PHP code.

SELECT count(client_ip) as client_requests, client_ip, target_ip, request_url, 
target_status_code 
FROM alb_logs 
WHERE target_status_code not in ('200','301','302','304') 
GROUP BY client_ip, target_ip, request_url, target_status_code
ORDER BY client_requests desc; 

Athena is a serverless tool, and it sets up in seconds and the charges based on TB scanned with a 10MB minimum for the query.

One of the more interesting AWS Big Data Services is Amazon Athena. Athena can process S3 data in a few seconds. One of the ways I like using it is to look for patterns in ALB access logs.

AWS provides a detailed instruction on how to setup Athena on...

DevOps Engineering on AWS

I took DevOps Engineering on AWS for the last three days. The course is part of the learning process for the AWS Certified DevOps Engineer – Professional Overall the course is excellent it covers substantial material, and the labs are ok. To become proficient, one should do the labs from scratch and build the CloudFormation templates. It reviews 45-50% of the material for the on the DevOps Exam, so each topic requires a deeper dive before sitting the exam.

Here is my summary by day of the course.

Day One

The class started with an introduction to DevOps and the AWS tools which support Devops:

It’s interesting as CodeBuild, CodeDeploy, and CodePipeline are required to replace Jenkins. Their advantage is that it directly integrate with AWS. One question I have is why isn’t there a service like Jfrog Artifactory

One of my favorite topics was DevSecOps which talks about adding security into the DevOps process. There should be a separate certification and course for DevSecOps or SecDevOps.

There was a minimum discussion on Elastic Beanstalk, which was a big part of the old acloud.guru course and had several questions on the old exam.

Lastly, the day focused on various methods for updating applications. In-place updates Rolling updates Blue/Green Deployments Red/Black Deployments

Day Two

The class started with a lab on CloudFormation. The lab was flawed as it had a code deployment via the cfn-init and cfn-hup. The rest of the morning was a deeper dive on the tools discussed throughout Day 1.

Afternoon lab focused on a pipeline, CodeBuild, and CodeDeploy. After the lab, we spent time discussing various testing, CloudWatch Logs, and Opsworks. Most of the discussion was theoretical.

Day Three

The first part of the morning was a 2-hour lab on AWS Opsworks setting up a Chef recipe and scaling out the environment. The rest of the class was devoted to containers, primary ECS, with a lab that deployed an application on containers.

It’s an interesting course and worth taking if you’re doing AWS DevOps or planning to take the certifications.

I took DevOps Engineering on AWS for the last three days. The course is part of the learning process for the AWS Certified DevOps Engineer – Professional Overall the course is excellent it covers substantial material, and the labs are ok. To become proficient, one should do the...

Goodnotes 5

Goodnotes 5 was released last week. Goodnotes is my favorite stylus note taking app on the IPad. I’ve tried most of the competitors at least once and revisit them when they release new features. I’ve been on Goodnotes for years and have been using it daily.

Let’s move to the topic of this blog, Goodnotes 5 is a bit buggy. There were a ton of negative comments on Twitter towards the release. The development team has released 7 updates as of the writing of this blog. Goodnotes 5 is not a forced upgrade from version 4. While I’ve not seen all the problems described on Twitter, I’ve seen a few of the issues. I knew installing the initial release, and there were going to be some bugs.

However if you think about the DevOps model release, fix, release, fix, release, fix. The model is built for this type of release and user feedback.

However, many of the twitter complaints, where why was buggy software released. So it made me think about when is software ready for release in the DevOps model? Typically there is a release once code passes, unit tests, integration tests, load tests, functional tests, and GUI Tests. However bugs do reach production and the users, there is no fool-proof plan.

App store doesn’t allow releasing of beta software. However does offer TestFlight, so maybe GoodNotes could have leverage 10,000 of its customers to beta test the software and avoided the negative backlash on Twitter.

Goodnotes 5 was released last week. Goodnotes is my favorite stylus note taking app on the IPad. I’ve tried most of the competitors at least once and revisit them when they release new features. I’ve been on Goodnotes for years and have been using it daily.

Let’s move...

Jekyll

Decided to try an switch from Wordpress to Jekyll. While Wordpress provides a ton of features, the interface for creating blog entries is overly burdensome. Also, Wordpress continues to announce security vulnerabilities. Jekyll uses a markdown file which provides for a pure editing experience. However, most anything in Jekyll requires modification of layout and include HTML files. Jekyll uses some Liquid to provide development capabilities inside the HTML files. Jekyll combines the templates with the markdown into static HTML files.

My two favorite things are that Jekyll can be run on a local workstation so you can preview changes and everything can check into a Git Repository

This is the initial release, aside from some minor issues, content is showing up. Next release of this blog will include comments and search functionality.

Decided to try an switch from Wordpress to Jekyll. While Wordpress provides a ton of features, the interface for creating blog entries is overly burdensome. Also, Wordpress continues to announce security vulnerabilities. Jekyll uses a markdown file which provides for a pure editing experience. However, most anything in...

Cloud Practioner

Passed the AWS Cloud Partitioner Certification Exam. Given I have 7 of the 9 certifications before sitting this exam, I didn’t study. The goal before taking the exam was 100% in 20 minutes. I missed 3 questions and took 16 minutes. I took the exam at some point I am going to complete the Big Data Speciality, which will give me all the AWS certifications for a brief moment. The Machine Learning AI beta completed last month and the Alexa Skill Builder just completed its beta. This means by March there could be 10 or 11 AWS Certifications.

Passed the AWS Cloud Partitioner Certification Exam. Given I have 7 of the 9 certifications before sitting this exam, I didn’t study. The goal before taking the exam was 100% in 20 minutes. I missed 3 questions and took 16 minutes. I took the exam at some point I...

DevOps Pro Links

I posted to Github a list of links I found valuble when studying for the AWS DevOps Pro certification exam.

The original blog article about passing the test can be found here AWS Certified DevOps Engineer - Professional

I posted to Github a list of links I found valuble when studying for the AWS DevOps Pro certification exam.

The original blog article about passing the test can be found here AWS Certified DevOps Engineer - Professional