Skip to content

Instantly share code, notes, and snippets.

@supinf
supinf / s3-compile-js.js
Last active Aug 29, 2015
AWS Lambda script:: Compiling JavaScript files which are triggered by s3 events.
View s3-compile-js.js
var AWS = require('aws-sdk');
var async = require('async');
var path = require("path");
var mkdir = require("mkdirp");
var fs = require('fs');
var spawn = require('child_process').spawn;
exports.handler = function (event, context) {
// console.log('Event: '+JSON.stringify(event, true, ' '));
var key = event.Records[0].s3.object.key;
@supinf
supinf / s3-invalidation.js
Last active Jun 20, 2019
AWS Lambda script:: CloudFront Invalidations which are triggered by s3 events.
View s3-invalidation.js
console.log('Loading event');
var Q = require('q');
var aws = require('aws-sdk');
var cloudfront = new aws.CloudFront();
exports.handler = function (event, context) {
//_log('Received event: ', event);
var bucket = event.Records[0].s3.bucket.name;
View dynamic-websites-using-aws-sdk-index.html
<!DOCTYPE html>
<html lang="ja">
<head>
<title>AWS Javascript Browser SDK Example</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/nvd3/1.1.15-beta/nv.d3.min.css">
<script src="//sdk.amazonaws.com/js/aws-sdk-2.0.16.min.js"></script>
</head>
<body>
You can’t perform that action at this time.