Skip to content

Instantly share code, notes, and snippets.

View andrew-templeton's full-sized avatar

Andrew Templeton andrew-templeton

View GitHub Profile
All,
There have been questions about access to AWS resources, and how to gain tokens to make API requests. In order to reduce some of this friction, here is some context around how the system works.
Amazon Web Services uses a high-level identity management based on tokens, called IAM, or Identity and Access Management. There are several objects in this model: Groups, Policies, and Users. Each "User" is tied to a unique Access Key and Secret Key, analogous to a username and password on a Unix-like environment. These will henceforth be referenced as "Tokens" for sake of brevity. "Groups" are a logical grouping of users. One user may belong to many groups, and one group may have many users. "Policies" are pemission(s) granted to either Groups or Users. One policy may be granted to any number of these entities.
A "Policy" allows a Token pairing to make API calls. These policies, at a high level, consist of "Resources" and "Actions", which dictate who is allowed to do what on what resources. These are analog
function add(x, y) {
return x + y;
}
function toThe(pow) {
return function(base) {
return Math.pow(base, pow);
};
}

Tuple Labs Software Vendor Models

Foreword

These are the models of software vendors we use as a starting point for defining sales strategies at Tuple Labs in Austin, Texas. We think of classes of companies in the space differently so that we can best fit our proposals to deliver high ROI and follow our client company business models. You may use this work as long as you comply with the license terms.

It should be noted that many service providers and companies fall into multiple categories, and that the lines are not as clean as defined herein. At larger companies, one often sees different strategic business units operating under entirely different paradigms. Many offerings have features that blur the distinction between these models - these are simple guideline business models.

Finally, this document not meant to be a highly scientific treatment of the different kinds of software businesses. It is meant to be an approachable introduct

@andrew-templeton
andrew-templeton / example-ddb-scaler.json
Created November 21, 2015 21:44
Proposed CloudFormation custom resource interface for DynamoDB AutoScaler Resource
"MyDynamoAutoScaler": {
"Type": "Custom::DynamoDBAutoScaling",
"Properties": {
"TableName": {"Ref": "MyDynamoTable"},
"CheckInterval": 300,
"ScaleReadsUpAbove": 90,
"IncreaseReadsBy": 50,
"ScaleReadsDownBelow": 30,
@andrew-templeton
andrew-templeton / cron-regex.js
Created February 28, 2016 06:05
Regex to validate cron expressions
"^\\s*($|#|\\w+\\s*=|(\\?|\\*|(?:[0-5]?\\d)(?:(?:-|\/|\\,)(?:[0-5]?\\d))?(?:,(?:[0-5]?\\d)(?:(?:-|\/|\\,)(?:[0-5]?\\d))?)*)\\s+(\\?|\\*|(?:[0-5]?\\d)(?:(?:-|\/|\\,)(?:[0-5]?\\d))?(?:,(?:[0-5]?\\d)(?:(?:-|\/|\\,)(?:[0-5]?\\d))?)*)\\s+(\\?|\\*|(?:[01]?\\d|2[0-3])(?:(?:-|\/|\\,)(?:[01]?\\d|2[0-3]))?(?:,(?:[01]?\\d|2[0-3])(?:(?:-|\/|\\,)(?:[01]?\\d|2[0-3]))?)*)\\s+(\\?|\\*|(?:0?[1-9]|[12]\\d|3[01])(?:(?:-|\/|\\,)(?:0?[1-9]|[12]\\d|3[01]))?(?:,(?:0?[1-9]|[12]\\d|3[01])(?:(?:-|\/|\\,)(?:0?[1-9]|[12]\\d|3[01]))?)*)\\s+(\\?|\\*|(?:[1-9]|1[012])(?:(?:-|\/|\\,)(?:[1-9]|1[012]))?(?:L|W)?(?:,(?:[1-9]|1[012])(?:(?:-|\/|\\,)(?:[1-9]|1[012]))?(?:L|W)?)*|\\?|\\*|(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)(?:(?:-)(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC))?(?:,(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)(?:(?:-)(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC))?)*)\\s+(\\?|\\*|(?:[0-6])(?:(?:-|\/|\\,|#)(?:[0-6]))?(?:L)?(?:,(?:[0-6])(?:(?:-|\/|\\,|#)(?:[0-6]))?(?:L)?)*|\\?|\\*|(?:MON|TUE|WED|THU|FRI|S
@andrew-templeton
andrew-templeton / aws-cloudwatch-events-rule-scheduleexpression.js
Created February 28, 2016 07:59
Full Regex for ScheduleExpression property of AWS CloudWatch Events Rule
"^(rate\\(((1 (hour|minute|day))|(\\d+ (hours|minutes|days)))\\))|(cron\\(\\s*($|#|\\w+\\s*=|(\\?|\\*|(?:[0-5]?\\d)(?:(?:-|\/|\\,)(?:[0-5]?\\d))?(?:,(?:[0-5]?\\d)(?:(?:-|\/|\\,)(?:[0-5]?\\d))?)*)\\s+(\\?|\\*|(?:[0-5]?\\d)(?:(?:-|\/|\\,)(?:[0-5]?\\d))?(?:,(?:[0-5]?\\d)(?:(?:-|\/|\\,)(?:[0-5]?\\d))?)*)\\s+(\\?|\\*|(?:[01]?\\d|2[0-3])(?:(?:-|\/|\\,)(?:[01]?\\d|2[0-3]))?(?:,(?:[01]?\\d|2[0-3])(?:(?:-|\/|\\,)(?:[01]?\\d|2[0-3]))?)*)\\s+(\\?|\\*|(?:0?[1-9]|[12]\\d|3[01])(?:(?:-|\/|\\,)(?:0?[1-9]|[12]\\d|3[01]))?(?:,(?:0?[1-9]|[12]\\d|3[01])(?:(?:-|\/|\\,)(?:0?[1-9]|[12]\\d|3[01]))?)*)\\s+(\\?|\\*|(?:[1-9]|1[012])(?:(?:-|\/|\\,)(?:[1-9]|1[012]))?(?:L|W)?(?:,(?:[1-9]|1[012])(?:(?:-|\/|\\,)(?:[1-9]|1[012]))?(?:L|W)?)*|\\?|\\*|(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)(?:(?:-)(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC))?(?:,(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)(?:(?:-)(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC))?)*)\\s+(\\?|\\*|(?:[0-6])(?:(?:-|\/|\\,|#)(?:[0-6]))?(?:L)?(?:,(?:[0-
@andrew-templeton
andrew-templeton / vpc.json
Created April 1, 2016 02:20
CloudFormation template packaging a serverless VPC for fixed/static IPs on Lambdas
{
"Description": "Host VPC for Lambda Static IPs",
"Parameters": {
"VPCClassBOctet": {
"Type": "Number",
"Description": "The Class B block to use for the VPC (0-255).",
"MaxValue": 255,
"MinValue": 0,
"Default": 0
},
@andrew-templeton
andrew-templeton / index.js
Created April 1, 2016 03:12
lambda function to test the IP of your lambda as seen by ifconfig.co
var http = require('http');
exports.handler = function (event, context) {
http.get('http://ifconfig.co', function (res) {
var buff = [];
console.log('Got response: %s', res.statusCode);
res.on('data', function (chunk) {
buff.push(chunk);
});
res.on('end', function () {
console.log('Found: %s', buff.join(''));
@andrew-templeton
andrew-templeton / index.js
Last active June 6, 2016 18:52
Embedded Lambda custom resource for getting an EB Environment's ELB's CanonicalHostedZoneId
var AWS = require('aws-sdk');
var response = require('cfn-response');
exports.handler = function(event, context) {
console.log('REQUEST RECEIVED: %j', event);
if (event.RequestType == 'Delete') {
response.send(event, context, response.SUCCESS);
return;
@andrew-templeton
andrew-templeton / rule.json
Last active June 24, 2016 18:57
Generic lambda cron CloudFormation substack
{
"Parameters": {
"TARGET_LAMBDA_ARN": {
"Type": "String"
},
"EXEC_SCHEDULE": {
"Type": "String"
},
"RULE_NAME": {
"Type": "String"