STOP! In the name of billing, before you break my pocketbook…

Okay, maybe you don’t get that reference, I’ll explain it at the end.

Lately I’ve been stopping my instance at night and restarting it in the day to keep costs down. But I’ve decided to stop doing that and just keep the site running regardless since the billing still won’t be THAT expensive.

I will also eventually set up an elastic IP since I’m already paying $0.005 an hour for a static IP, and an elastic IP is about the same cost. Might as way get one if the cost is, you know, the same…

Okay, the reference is from “STOP! In the name of Love!”, a song by the Supremes. Those Motown songs were the best.

The Supremes, 1966

Upgraded from t2.micro to t2.small – Let’s see if this works

As I’ve said before, I’m trying to make this system as cheap as possible. However, I was running a t2.micro instance and while that’s cheap, the system only comes with 1 GB of RAM. The MySQL database would often crash and this website was unavailable. I would have to restart services (or the entire EC2 instance) to get it back up.

Since this makes the website unusable it’s not enough for me to keep. So while it’s “cheap”, it’s ineffective. I’ve upgraded to a t2.small config which has double the RAM. Granted, 2 GB is pretty tiny so we’ll see if this works.

 

Bold strategy Cotton meme

Running a cheaper Spot Instance

Spot instances can make running a website really, really cheap. In my experience, though, it hasn’t been as cheap as I had hoped. So I re-created this site using a t2.micro EC2 instance which is supposed to run at less than $0.01 an hour.

Of course, as the site runs, it needs a static IPv4 address which adds an additional half a cent cost. This isn’t super expensive, mind you, but it adds up.

Azure Training – Day one

I’ve been training for Azure certs for a short while but this is my first real entry.

There are a number of certs I want to pursue. The first one to really get is AZ-900 which is basically like an Introduction to Azure certification. You can’t really do much with it but it would serve as a foundation for other training.

The one I’m really interested in (and working on right now) is “Microsoft Certified Azure Data Fundamentals”, which goes into the data storage and management functions in Azure. This is more in-depth than AZ-900 and looks like it could have some really practical uses.

Azure training – Prologue

I’ve decided to get into Azure and get some certifications to make myself a more viable candidate for future positions. Personally I like AWS much better than Azure, but since most businesses use Microsoft learning Azure is pretty much mandatory for cloud computing enthusiasts.

So – we’re back – with a NEW spot instance!

Okay, I haven’t posted for a few months YEARS now – sorry!

I had been running this site on a (very) basic EC2 spot instance for a while, then I found out last month that the bid price was too low and it wouldn’t start. For some reason, AWS doesn’t let you just change the bid price – you have to create an entirely new spot instance.  This isn’t that hard but if you haven’t done it for 4+ years, it’s a bit of a challenge.

Luckily I managed to get it all up and running, but it took looking at an AWS guide to get it to work.

What is with Webadmins in Japan?

Okay, this is just one example but I’ve seen this happen dozens (maybe hundreds) of times in Japan and I can’t figure out why. For some reason when a website has the prepended “www” in the FQDN, you MUST include the www when you enter the URL or it won’t work. This is really clumsy because it only takes a small tweak in your web server settings to automatically prepend the “www” to make the site launch properly.

I just heard about a great Python lab and the URL was www.startlab.media. Since virtually every site will prepend the “www”, I entered the root domain name, and this is what I got:

Nice to see they’re running nginix. So on the next run I prepended the “www” and the site loaded properly:

Ah, that’s more like it! Mind you, this is a minor point, but it’s a pretty basic one. I’m not quite sure why web admins in Japan consistently overlook this but I can’t tell you how many times I’ve run into this.

Using Python for a redundant directory listing

A client asked me about help on a Python script. I jumped into my seat and excited typed “OF COURSE!!”, more excited than Dug getting to play fetch.

She was using Python to run a DOS command. This isn’t a horrible way to do things, actually, it is a horrible way to do things so I tried to ween her off this and use a more Pythonic way of doing it. (Okay, full disclosure, I use this for my scripts so they stay live after they’re finished:)

os.system("pause")

I didn’t get the entire code, but this was what she eventually came up with that worked:

subprocess.call(["dir"+"/O:-D/A:-D",bookingFilePath1, ">>","tmp2.txt"], shell=True )

It’s cool that she’s using the subprocess but this isn’t the “Python” way of doing things. At the very least, if you get the result you need without a bug then that should suffice. But being a Pythonista means delving deeper until you come up with the most Python-like solution.

What I came up with is the following, which worked perfectly and is mostly Pythonic:

import os

targpath = "C:\\users\\ReedActed\\desktop\\" # To direct location of target file

with open(targpath + 'P-drive-test.txt', 'w', encoding='utf-8') as outfile:
  for r, d, f in os.walk('P:\\backup\\'):
    for file in f:
     fileneat = os.path.join(r, file) + "\n"
     outfile.write(fileneat)

Regrettably, she found out what her error was and continued to use the DOS command in Python rather than use Python’s native libraries. *SIGH*