This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Require the demo configuration. This contains settings for this demo, including | |
// the AWS credentials and target queue settings. | |
var config = require( "./config.json" ); | |
// Require libraries. | |
var aws = require( "aws-sdk" ); | |
var Q = require( "q" ); | |
var chalk = require( "chalk" ); | |
// Create an instance of our SQS Client. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var AWS = require('aws-sdk'), | |
fs = require('fs'); | |
// http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html#Credentials_from_Disk | |
AWS.config.loadFromPath('./aws-config.json'); | |
// assume you already have the S3 Bucket created, and it is called ierg4210-shopxx-photos | |
var photoBucket = new AWS.S3({params: {Bucket: 'ierg4210-shopxx-photos'}}); | |
function uploadToS3(file, destFileName, callback) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Installation: | |
* npm install aws-sdk | |
* npm install async | |
* node awsDownloadFilesInBucket.js | |
*/ | |
// SETTINGS | |
var AWS_KEY = ''; | |
var AWS_SECRET = ''; | |
var BUCKET = ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Security groups that contain 0.0.0.0/0 rules | |
aws ec2 describe-security-groups --filters Name=ip-permission.cidr,Values=0.0.0.0/0 --output=text | grep SECURITYGROUPS | |
# Security groups for ElasticSearch | |
aws ec2 describe-security-groups --filters Name=ip-permission.from-port,Values=9200 --output=text | grep SECURITYGROUPS | |
# Search last 10,000/1MB of CloudTrail logs for 'AccessDenied' (removed AWS account number from stream name) | |
aws logs get-log-events --log-group-name CloudTrail/DefaultLogGroup --log-stream-name 000000000000_CloudTrail_eu-west-1 | grep AccessDenied | |
# Get number of AWS API calls in time period (assumes a Cloudwatch Logs 'catch-all' filter and metric has been created against CloudTrail logs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
source ./.awssec | |
# | |
# Grab local file and put it in $BUCKET/$S3/path/$FILE | |
# | |
function s3-put() | |
{ | |
[[ $@ == "" ]] && |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
AWS_DEFAULT_ZONE='us-east-1' | |
aws_status() | |
{ | |
echo $(aws ec2 describe-instances --instance-ids="$1" | jq -r '.Reservations[0].Instances[0].State.Name') | |
} | |
aws_snapshot_status() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -x | |
# The bucket containing the userdata.d | |
export USERDATAD_BUCKET=userdata.example.com | |
# Required to set the endpoint of the aws-cli | |
export AWS_DEFAULT_REGION=eu-west-1 | |
# Install Prerequisites | |
yum install -y aws-cli | |
# Download all .sh scripts from the bucket and pipe to bash | |
SCRIPTS=$(aws s3 ls s3://$USERDATAD_BUCKET/userdata.d/ | awk '{ print $4 }') | |
for S in $SCRIPTS; do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z "$AWS_CREDENTIALS" ]; then | |
AWS_CREDENTIALS="$HOME/.aws/credentials" | |
fi | |
if [ ! -e "$AWS_CREDENTIALS" ]; then | |
echo "$AWS_CREDENTIALS missing; use 'aws configure'." | |
exit | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'); | |
var path = require('path'); | |
var webpackConfig = require('./webpack.config'); | |
var webpack = require('webpack'); | |
var webpackDevMiddleware = require('webpack-dev-middleware'); | |
var webpackHotMiddleware = require('webpack-hot-middleware'); | |
var proxyMiddleware = require('http-proxy-middleware'); | |
var devConfig = webpackConfig.devServer; | |
var app = express(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage: | |
# $ le-aws-upload-cert.sh | |
echo "Current list of certificates in AWS" | |
echo "-----------------------------------" | |
aws iam list-server-certificates | |
echo | |
read -p "Domain name: " domain_name |