View main.js
console.log("TriSens"); | |
var mraa = require('mraa'); | |
console.log('MRAA Version: ' + mraa.getVersion()); | |
var tempPin = new mraa.Aio(0); | |
var lightPin = new mraa.Aio(1); | |
var soundPin = new mraa.Aio(2); |
View main.js
console.log("start BiriBiriWorkerBox"); | |
// ==== config | |
var accountId = "123456789012"; | |
var cognitoRoleArn = "arn:aws:iam::123456789012:role/Cognito_WorkerBoxUnauth_DefaultRole"; | |
var cognitoIdentityPoolId = "us-east-1:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; | |
var queueUrl = "https://sqs.ap-northeast-1.amazonaws.com/123456789012/workerbox"; | |
// ==== mraa | |
var mraa = require('mraa'); |
View vpc-knowhow-2014-04.template
{ | |
"AWSTemplateFormatVersion": "2010-09-09", | |
"Description": "VPC knowhow template", | |
"Parameters": { | |
"KeyName": { | |
"Description": "Name of an existing EC2 KeyPair to enable SSH access to the instances", | |
"Type": "String", | |
"MinLength": "1", | |
"MaxLength": "64", | |
"AllowedPattern": "[-_ a-zA-Z0-9]*", |
View bgd-php.template
{ | |
"AWSTemplateFormatVersion" : "2010-09-09", | |
"Description" : "PHP Blue-Green Deployment environment template", | |
"Parameters" : { | |
"KeyName" : { | |
"Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instances", | |
"Type" : "String", | |
"MinLength" : "1", | |
"MaxLength" : "64", | |
"AllowedPattern" : "[-_ a-zA-Z0-9]*", |
View vpc-knowhow.template
{ | |
"AWSTemplateFormatVersion": "2010-09-09", | |
"Description": "VPC knowhow template", | |
"Parameters": { | |
"KeyName": { | |
"Description": "Name of an existing EC2 KeyPair to enable SSH access to the instances", | |
"Type": "String", | |
"MinLength": "1", | |
"MaxLength": "64", | |
"AllowedPattern": "[-_ a-zA-Z0-9]*", |
View fluentd.template
{ | |
"AWSTemplateFormatVersion": "2010-09-09", | |
"Description": "fluentd template", | |
"Parameters": { | |
"KeyName": { | |
"Description": "Name of an existing EC2 KeyPair to enable SSH access to the instances", | |
"Type": "String", | |
"MinLength": "1", | |
"MaxLength": "64", | |
"AllowedPattern": "[-_ a-zA-Z0-9]*", |
View cfn-init.template
{ | |
"AWSTemplateFormatVersion": "2010-09-09", | |
"Description": "simple template", | |
"Parameters": { | |
"KeyName": { | |
"Description": "Name of an existing EC2 KeyPair to enable SSH access to the web server", | |
"Type": "String", | |
"MinLength": "1", | |
"MaxLength": "64", | |
"AllowedPattern": "[-_ a-zA-Z0-9]*", |
View tungsten-eval.template
{ | |
"AWSTemplateFormatVersion": "2010-09-09", | |
"Description": "Tungsten Replicator evaluation", | |
"Parameters" : { | |
"KeyName" : { | |
"Description" : "Name of an existing EC2 KeyPair to enable SSH access to the web server", | |
"Type" : "String" | |
}, | |
"SlaveMasterPassword" : { | |
"Description" : "Password of RDS master user", |
View multiple-vpn-connection.template
{ | |
"AWSTemplateFormatVersion": "2010-09-09", | |
"Description": "Multiple VPN Connection between VPCs.", | |
"Parameters" : { | |
"KeyName" : { | |
"Description" : "Name of an existing EC2 KeyPair to enable SSH access to the web server", | |
"Type" : "String" | |
}, | |
"SSHFrom": { | |
"Description": "Lockdown SSH access to the bastion host (default can be accessed from anywhere)", |
View elbfailover.sh
#! /bin/bash | |
SELF_INSTANCE_ID=`curl -s http://169.254.169.254/latest/meta-data/instance-id` | |
ELB_NAME=elbfailover | |
SLEEPTIME=2 | |
while :; do | |
TIMESTAMP=`date -u +"%Y-%m-%dT%H:%M:%SZ"` | |
ELB_STATUS=`aws elb describe-instance-health --load-balancer-name $ELB_NAME` | |
HEALTHY_HOST_COUNT=`echo $ELB_STATUS | jq "[ .InstanceStates[] | select(.InstanceId != \"$SELF_INSTANCE_ID\" and .State == \"InService\") ] | length"` |