JohnBrumbaugh.com

daily-news

A 2 post collection


A Case Study in Over-Engineering

 •  Filed under illiniboard, daily-news, lambda

In an effort to procrastinate even in my free time, I have spent the last month or so trying to understand AWS CodeBuild, AWS CodePipeline, and AWS CodeDeploy. While I get everything at the high-level, I haven't been able to actually figure out my simple goal: deploy code for the IlliniBoard Daily News Job to my AWS Lambda function that will run it.

The thing that gets me is this should be really damn easy, and I cannot figure it out. No idea why. Here are the simple steps that I think I should be able to do:

  1. Check Code into GitHub.
  2. Build the code using AWS CodeBuild
  3. Deploy the code to an AWS Lambda Function using AWS CodeDeploy.

I mean this is as simple a process as you can get. But for some reason, I could not figure it out as I think my use case was just too simple as all of the documentation talks about things way more complicated than this, especially surrounding AWS CodeDeploy, my actual hangup. All the rest worked.

So after a few nights of trying different things, I decided to look at other options. I know I didn't need to use CodeDeploy, but I was thinking it would be a way for me to learn the technology for when I actually need it. I guess that is going to have to come another day since this has just frustrated me a bit too much.

So what was my solution? Leveraging the AWS Command Line interface and Gradle. It's pretty damn simple actually this way and integrated into my already working build process. I just automated the step of uploading the ZIP file to Lambda which has been annoying me.

The first thing I did was create a simple bat file that I can call to execute the AWS CLI. It simply had the following contents:

aws lambda update-function-code --function-name daily_news_execute --zip-file fileb://c:/users/john/illiniboard/illiniboard-dailynews-v2/build/distributions/illiniboard-dailynews-v2.zip

Simple. Elegant. And it works. Then I updated my Gradle script with the following task.

`task deployToLambda ( type: Exec ) {
commandLine 'cmd', '/c', 'deploy_to_lambda.bat'
standardOutput = new ByteArrayOutputStream()

ext.output = {
    return standardOutput.toString()
}

}`

It's that simple. Now, all I need to do to build and push to my Lambda function is type in: gradle deployToLambda. It's not elegant, but it works. Sure, I still need to learn how to use AWS CodeDeploy, but right now I just want to get the Daily News Job done as I often times to forget to run it, and then stories aren't posted. I just need to get this thing running every hour or so and be done with it. So now I can focus on finishing the actual coding, not the stuff that I was trying to learn while procrastinating from that because it just isn't that interesting to me to update.

Project: Updating the Daily News Job

 •  Filed under illiniboard, daily-news, aws, lambda

Switching jobs at the beginning of July had one unforseen consequence, the IlliniBoard Daily News job wasn't going to run everyday. I know I shouldn't have, but I had set it up to run on my work Mac Book, and it just went. I didn't have to think about it, it just worked. Not perfectly, but it worked well enough. Now, I don't have that laptop up and running everyday and I don't want to have IlliniBoard stuff on my new work laptop. So what's someone to do?

Simple: Re-write the job to allow me to test out some new stuff.

Over this week, I plan on re-writing the majority of the Daily News job and writing about what is happening with it on here. Basically, I want to move the job to run as an AWS Lambda function. This has a few benefits to me:

  1. I get learn a bit more about Lambda which I have only used for Alexa Skills.
  2. Once it's done, I can forget it's there and I don't have to worry about making sure a server is up.
  3. I can focus on some other stuff for IlliniBoard.

It's getting late tonight, and I am a bit tired. So I won't do much tonight, outside of updating the home page for Robert's Training Camp items. Then I will go check on Jack, read a bit, and then head to bed.