AWS Developer Certification – My Plan

Below is my plan to obtain the AWS Developer Certification.

For each of the following areas listed further down, I am trying to do the following:

  • Read the FAQ’s
  • Practice in the console
  • Practice with the CLI and understand the functions\parameters
  • Review all HTTP codes
  • Review all defaults and limits
  • Review uniqueness of each area

Here are the areas I am covering in preparation for the exam.

  • EC2
  • S3
  • DynamoDB
  • SNS
  • SQS
  • VPC
  • ELB
  • Lambda
  • Route 53
  • RDS
  • SWF
  • Cloudformation
  • Elastic Beanstalk
  • API Gateway
  • Storage Gateway
  • EFS
  • CloudWatch
  • CloudTrail
  • IAM

The exam is only 55 questions, so i’m not sure how in depth the exam will go on each of these.  Regardless, its a good to review all of the areas!

Python – Tesseract – OCR – IMAGE

You can do some pretty cool things with tesseract-ocr.  Using PyOCR, which is a wrapper for Tesseract, you can generate text from an image using Tesseract.

Example Image:

aws_.jpg

Example Output:

Tesseract.png

Example Code:

from wand.image import Image
from PIL import Image as PI
import pyocr
import pyocr.builders
import io
import sys

reload(sys) 
sys.setdefaultencoding('utf8')
 
tool = pyocr.get_available_tools()[0]
lang = tool.get_available_languages()[1]
 
txt_list = tool.image_to_string(
 PI.open('/home/build/aws.jpg'),
 lang=lang,
 builder=pyocr.builders.TextBuilder())

outputFile = open('output.txt', 'w')
for item in txt_list:
 outputFile.write("%s" % item)
outputFile.close()

Another use case I was working on today was rendering the text in a PDF file using Tesseract.  I was converting the PDF to an image file first, then performing the above actions to read the text from the new image.

Here are a couple valuable resources I used to complete this little test.

  • Installing Tesseract on a RHEL system – http://www.keienberg.com/install-tesseract-3-04-centos-7/ (link)
  • Installing PyOCR and other image conversion tools – https://pythontips.com/2016/02/25/ocr-on-pdf-files-using-python/ (link)

Getting all the prerequisites installed was by far the hardest part on this effort.

AWS Consistency Models

S3 Consistency Model

  • Puts (New record) = Read-after-write consistency model
  • Updates and Deletes = Eventual consistency model

DynamoDB Consistency Model

  • Write = Eventual consistency model
  • Read = Eventual consistency model
  • Read  = Optional – Strong consistency model

Definitions

  • Read-after-write consistency model = New objects should be available with out delays to clients.
  • Eventual consistency model = “Eventually” all access attempts to a particular item will return the last updated value.  There is potential here for stale or old data reads while data replication occurs.
  • Strong consistency model = All access attempts (e.g. parallel) to a particular item return the same unique state.  Old\stale data reads are avoided, but it will cost you more.

Good information to know for any AWS certification tests…. 🙂

AmazonWebservices_Logo.svg_

Docker Hub – Build Hooks

I tried out the Docker Hub post_push hook script today with my automated build and it works great.  This link has all the details around more advanced Docker Hub build scripting.

What I tried using the post_push script for was to tag my mainline build (latest) with another specific tag (release).

Steps to implement:

  1. Create a hooks folder in my GitHub repo.
  2. Create a script called “post_push” under the hooks folder that will tag the latest image with my release number.

    #!/bin/bash
    set -e
    tagStart=$(expr index “$IMAGE_NAME” 🙂
    repoName=${IMAGE_NAME:0:tagStart-1}
    docker tag $IMAGE_NAME ${repoName}:18.3.1
    docker push ${repoName}:18.3.1

The end results is the following:

postpushdocker.png

So a possible use-case would be to have a Jenkins job that gets triggered when your Dockerfile changes in GitHub and updates the release version in the “post_push” script, then triggers the Docker Hub job.

dockericon

Docker Goodies – Frequent Commands

Noting some of the usual Docker commands I run for future reference…

  • Start Docker daemon = systemctl start docker
  • View running Docker images = docker ps
  • View all images on the server = docker images or docker image ls
  • Remove all images on the server (dangling and unused) = docker images prune -a
  • Build my image = docker build -f <dockerfile_path> .
  • Run my Docker image and check Ansible version = docker run –rm -it <image_id> –version
  • Tag new image = docker tag <image> devopsunleashed/ansible:3.31.1
  • Login to Docker Hub = docker login -u <user> -p <pw>
  • Push image to Docker Hub = docker push devopsunleashed/ansible:3.31.1

Awesome Docker command cheat-sheet (link)

dockericon

Docker Build Error – Temporary Error (try again later)

When building a new Docker image from Alpine 3.6 (RUN apk –update add –virtual build-dependencies gcc ...), I encountered the following errors:

I found 2 separate solutions to work around these errors.

  1. Utilize “–network=host” when building the new image.
    • This option will force the Dockfile’s “Run” instruction to use the Docker host network stack
  2. Set the Docker DNS server globally on the build host.  Add “-dns x.x.x.x” to the DOCKER_OPTS variable.  After you make this property change, you will need bounce the Docker daemon.

I’m also going to try to update my Dockerfile to work around this issue, but wanted to get this info documented before I forget.

dockericon