Blog Entries

Use a Lambda Function to Reboot EC2 Instance when Unresponsive

Scenario: I have an EC2 Instance, t2.micro, that hosts a WordPress site. Every so often, the website becomes non-responsive and the EC2 instance needs to be rebooted. In this blog post, we’ll create a Lambda function that makes an HTTP Request to the website. If the HTTP Request fails three consecutive times in a row, we’ll reboot the instance. An email or notification will be sent to the responsible party to verify the instance is back up and operational.

Continue reading

Splitting one file into multiple files - Windows Batch Scripting

Scenario: I have a large file that I want to seperate into many different files based on a common string. I want to run this tool on my Windows machine. The output files should be sent to a different folder. Windows Batch file: On your Windows machine, create a folder. Copy the file that you want to seperate into many files into the folder. Create a new file with a .

Continue reading

Invoking Lambda Functions in a Different Account via S3 Upload

In a recent Blog post, we talked about giving Lambda functions access to resources in another account. In this Blog entry, we’ll investigate how to invoke a Lambda Function in another account by using AWS’ S3 event notifications. We assume you already have a Lambda function in a different account that you want to invoke. We’ll identify the necessary steps to trigger the function by uploading files to an S3 bucket.

Continue reading

Minify your HUGO site - HTML/CSS/JS/XML - the fast way

Install NodeJs/NPM Add this file to your HUGO’s root folder package.json { "name": "My-Hugo-Site", "version": "1.0.0", "description": "Check out my awesome site!", "main": "index.html", "scripts": { "build": "gulp build" }, "devDependencies": { "babel-preset-es2015": "^6.5.0", "babel-register": "^6.26.0", "gulp": "^3.9.1", "gulp-clean-css": "^3.0.4", "gulp-cli": "^1.2.1", "gulp-htmlmin": "^1.3.0", "gulp-shell": "^0.5.2", "gulp-uglify": "^2.1.2", "run-sequence": "^1.1.5" }, "babel": { "presets": [ "es2015" ] }, "author": "author" } Run npm install in your HUGO’s root folder

Continue reading

Giving AWS Lambda Cross-Account Access to Resources

Scenario: I have two AWS accounts: Account A and Account B. In Account A, I have a Lambda function that needs to access resources in Account B. How do we do this? It turns out, it’s not so hard. In fact, you can define any level of access to the Lambda functions as if they were in the same account. Basic Walkthrough: What allows cross-account access is AWS’ STS (Security Token Service).

Continue reading