21. June 2017 20:10
by Aaron Medacco
0 Comments

AWS re:Invent 2017 Public Registration Now Open

21. June 2017 20:10 by Aaron Medacco | 0 Comments

Public registration for AWS re:Invent 2017 is now open! For those who don't know, AWS re:Invent is the annual conference Amazon Web Services throws where participants can attend labs, breakout sessions, hackathons, bootcamps, and games in Las Vegas.

AWS re:Invent 2017

The conference runs from Nov. 27th to Dec. 1st this year and conference passes do sell out so if you want to attend, you'll need to move. The resources I've read have said the most difficult part is finding adequate accommodations, not necessarily getting your conference pass, especially as the event gets closer. Fortunately, this year's registration allows the ability to book your hotel and accommodations with your conference pass, which was convenient. Apparently, this is the first year AWS is allowing you to do this. I tossed around the idea of flying but since I'm fairly close being in Scottsdale, AZ, I've decided to take the 6-7 hour drive up instead.

Needless to say, I booked my pass and hotel already. I'll be arriving Monday morning and staying at the Bellagio for all 5 nights, which lies in between where all the AWS action is happening for the week. And even though I'll definitely be doing some gambling (poker) while I'm there, I'm going to do by best to stay focused and hit as many of the breakout sessions as possible. Because of the sheer volume of content and activities taking place each day, you can only attend a fraction of the events, so I'll have to figure out my schedule once Amazon releases the date and times for everything going on that week. I'll put a post up once I know the exact schedule. For now, AWS has a rough map of the strip so you can get an idea of what will be where.

AWS re:Invent 2017 Receipt

AWS also proctors their certification exams at the event on each day so I'll be taking my shot at the AWS Solution Architect - Professional and possibly the AWS DevOps Engineer - Professional certifications while I'm there. Between work, exercise, blogging, and a course on AWS Athena I'm creating for Pluralsight, it'll be fun finding the time to study for those. Fortunately, there going on all 5 days of the event, so I'll be able to pick when I want to take it. 

Additionally, given the announcements, crowd, and overall spectacle of the event, I'll be putting together posts for each day as well as taking pictures and possibly creating vlogs during the event. I think the internet could do with some more content showcasing the event firsthand from participants. A lot of what I found is AWS's own marketing and details.

Again, as more details come out about the exact schedule of everything, I'll do a post of the events I'll be at. If anyone else going wants to meet up, leave a comment. Super excited for November!

Cheers!

16. June 2017 22:58
by Aaron Medacco
4 Comments

New AWS Training Portal, Beta Certifications & Certification Swag Available

16. June 2017 22:58 by Aaron Medacco | 4 Comments

There's been quite a bit of news lately about AWS training and certification in the last few months. Jeff Barr announced on the AWS blog the release of the new AWS training portal. This change makes it easier for you to manage your certification and training in one location. Personally, I haven't needed to schedule a certification exam since January, but the process certainly could have been improved back then. Anything where I need to create more online accounts and remember more URLs is tedious. 

Upon signing in to the new portal, I did some exploring and it looks like, as part of this update, AWS offers benefits to those who become certified including free practice exam vouchers and access to their Certification Store. Even though the fees for practice exam are only up to $40, providing these small, extra incentives to continue progressing through their certification roadmap is certainly welcome.

The store had me a bit excited, too. I'm always complaining that companies or brands I love don't offer enough merchandise for users to buy and walk around in. I mean come on...even if you don't make your money on selling the products, the free advertising should be worth it you would think. I ordered all the Associate level gear available except for the laptop case, which wasn't in stock. I'll have to remember to get that once it becomes available. Since I don't hold either of the two Professional level certifications, I couldn't tell if the store held exclusive items available to only that group of the AWS community. However, the store interface seemed to suggest that was the case.

AWS Certification Gear

In other news, AWS has released 2 of the 3 long-awaited specialty certifications. 

There was another certification, the AWS Certified Security - Specialty that was also in beta but I suspect it's not yet ready.

Exciting stuff, however I'll still be pursuing the Professional certifications prior to studying for the specialty ones. Having the opportunity to validate expertise with these exams is great, both as a competency self-check and (more importantly) as a way for customers to know the people they trust their cloud resources with have a clue.

After all, no one wants to hire this guy:

This is fine

Cheers!

4. June 2017 20:42
by Aaron Medacco
0 Comments

Scheduling URL Requests w/ AWS Lambda

4. June 2017 20:42 by Aaron Medacco | 0 Comments

There's often a need to request URLs in a scheduled fashion. Whether it's performing a health check on a page, hitting an endpoint that crunches some data, or interacting with a public API of some kind, being able to automate this kind of behavior is often desired. Fortunately, this can be done quite easily with AWS Lambda. Also, because Lambda is serverless, you don't need to worry about machine failure, if for instance, you were to brew your own solution and put it on a specific server or instance. 

Automated URLs

In this post, I'll demonstrate how to build this by using AWS's Lambda service in conjunction with the HTTP and HTTPS libraries available from Node.js. We'll cover permission setup, function creation, and how to input the URLs you'd like to request on a schedule.

Let's get started.

Creating an IAM policy for access permissions:

  1. Navigate to IAM in your management console.
  2. Select "Policies" in the sidebar.
  3. Click "Create Policy".
  4. Select "Create Your Own Policy".
  5. Enter an appropriate policy name and description.
  6. Paste the following JSON into the policy document:
    {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Effect": "Allow",
          "Action": [
            "logs:CreateLogGroup",
            "logs:CreateLogStream",
            "logs:PutLogEvents"
          ],
          "Resource": "arn:aws:logs:*:*:*"
        }
      ]
    }
  7. Click "Create Policy".

Creating the IAM role for the Lambda function:

  1. Select "Roles" in the sidebar.
  2. Click "Create New Role".
  3. Enter an appropriate role name and click "Next Step".
  4. Select "AWS Lambda" within the AWS Service Roles.
  5. Change the filter to "Customer Managed", check the box of the policy you just created, and click "Next Step".
  6. Click "Create Role".

Creating the Lambda function:

  1. Navigate to Lambda in your management console.
  2. Click "Create a Lambda function".
  3. Select the "Blank Function" blueprint.
  4. Under "Configure triggers", click the grey box and select "CloudWatch Events - Schedule".
  5. Enter an appropriate rule name and description.
  6. Select the frequency you'd like your collection of URLs to be hit in the expression input. For instance, for daily, use "rate(1 day)".
  7. Check the box to "Enable trigger" and click "Next".
  8. Click "Next".
  9. Enter an appropriate function name and description. Select Node.js 6.10 for the runtime.
  10. Under "Lambda function code", select "Edit code inline" for the Code entry type and paste the following code in the box:
    exports.handler = (event, context, callback) => {
        var urls = event.urls;
        var http = require("http");
        var https = require("https");
        for (var i = 0; i < urls.length; i++) {
            var protocol = urls[i].Protocol;
            var domain = urls[i].Domain;
            var queryString = urls[i].QueryString;
            var url = protocol + "://" + domain + queryString;
            if (protocol.toLowerCase() === "http") {
                var j = i;
                http.get(url, function(res) {
                    // Get around async.
                    var requestUrl = urls[j].Protocol + "://" + urls[j].Domain + urls[j].QueryString;
                    console.log("Response from " + requestUrl + ": ");
                    console.log(res.statusCode);
                    console.log(res.statusMessage);
                }).on('error', function(e) {
                    console.log("Got error: " + e.message);
                });
            } else if (protocol.toLowerCase() === "https") {
                https.get(url, function(res) {
                    var j = i;
                    // Get around async.
                    var requestUrl = urls[j].Protocol + "://" + urls[j].Domain + urls[j].QueryString;
                    console.log("Response from " + requestUrl + ": ");
                    console.log(res.statusCode);
                    console.log(res.statusMessage);
                }).on('error', function(e) {
                    console.log("Encountered error: " + e.message);
                });
            }
            // Force break due to async -> output.
            if ((i+1) == urls.length) {
                break;
            }
        }
    };
  11. Leave Handler as "index.handler".
  12. Choose to use an existing role and select the role you created earlier.
  13. Leave the other default values and click "Next".
  14. Click "Create function".

Configuring the URLs to automate in CloudWatch:

  1. Navigate to CloudWatch in your management console.
  2. Select "Rules" in the sidebar.
  3. Click the name of the rule you created when creating the Lambda function.
  4. Click "Actions" -> "Edit".
  5. Under Targets, find your Lambda function and click "Configure input".
  6. Select "Constant (JSON text)".
  7. Paste JSON that conforms to this structure. Fill in the details for the URLs you would like to schedule. The following is an example:
    {
      "urls": [{
          "Protocol": "HTTP",
          "Domain": "www.aaronmedacco.com",
          "QueryString": ""
      }, {
          "Protocol": "HTTPS",
          "Domain": "www.google.com",
          "QueryString": "?key=value"
      }]
    }
  8. Remember to replace the above with your own URLs.
  9. Click "Configure details".
  10. Click "Update rule".

What if you want to configure different URLs on different schedules?

I'd recommend creating a different Lambda function similar to this one and using a different CloudWatch event rule to schedule it. Unless you want to get some kind of persistent storage involved or implement your own scheduling logic, it's probably easier to leverage the tools AWS has built, namely event rules in CloudWatch.

Cheers!

Copyright © 2016-2017 Aaron Medacco