Exporting the AWS ReInvent Calendar to iCal
2021 November 23

I went to AWS Reinvent this year, and I wanted my registered events to show up on my personal calendar. I’m honestly surprised they didn’t implement an iCal export for your registered events. So I took these steps to get them.

Getting the Information

  1. I used the network inspector to find a response that had my events on the calendar page. It seems to be one of the graphql calls shown in the inspector.

    Expected JSON content from the GraphQL endpoint

  2. I then copied and pasted the response into a text file, and used jq to explore the information. I found that my events were separated into 2 fields, mySessions and myFavorites.

jq '.data.event.mySessions.items + .data.event.myFavorites.items' data.json

This gave me my information as a JSON file that I can import into NodeJS.

Building the iCal file

I decided to use NodeJS for this, because it’s relatively easy to find an iCal library, and I can easily load my JSON file via require. I then just simply mapped the event entries to their proper locations per the library. I also needed to add a timezone since the JSON from the graphql used UTC time, and I wanted it to show up as the given timezone. You can peruse the code below for details.

const events = require('./events.json')
const ical = require('ical-generator')

function makeLocation(x) {
    var room = x.room.name;
    var venue = x.venue.name;

    return `${room} --- ${venue}`;
}

const newEvents = events.map((x) => {
    return {
        title: x.name,
        start: new Date(x.startTime),
        duration: {minutes: x.duration},
        description: x.description,
        location: makeLocation(x),
        geo: {
            lat: 36.114647,
            lon: -115.172813
        },
        timezone: 'America/Los_Angeles'
    }
});

const calendar = ical({name: 'aws reinvent hschmale'})

for (const event of newEvents) {
    calendar.createEvent(event);
}

console.log(calendar);

calendar.save('reinvent.ical');

The saved iCal file can then be exported into Google calendar via their import feature or served up from a HTTP endpoint. I personally prefer to serve it up from the endpoint, as then the events can’t be moved around.

However, I encountered some weirdness with sessions that were moved or something showing up in the wrong location, but overall it worked very well.


Remember you can also subscribe using RSS at the top of the page!

Share this on → Mastodon Twitter LinkedIn Reddit

A selected list of related posts that you might enjoy:

*****
Written by Henry J Schmale on 2021 November 23
Hit Counter