A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
# AWS S3 bucket for static hosting | |
resource "aws_s3_bucket" "website" { | |
bucket = "${var.website_bucket_name}" | |
acl = "public-read" | |
tags { | |
Name = "Website" | |
Environment = "production" | |
} |
# App ship-it stack with ECS, CodeBuild & CodePipeline. | |
# | |
# aws cloudformation deploy \ | |
# --stack-name myapp-prod \ | |
# --template-file ./aws-ship-it-stack.yaml \ | |
# --parameter-overrides \ | |
# KeyName=<KEY_NAME> \ | |
# GitHubAuthToken=<ACCESS_TOKEN> \ | |
# RepoOwner=<OWNER_NAME> \ | |
# RepoName=<REPO_NAME> \ |
#!/bin/bash | |
# AWS CLI | |
apt-get install zip -y; | |
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"; | |
unzip awscli-bundle.zip; | |
./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws; | |
aws configure; | |
#AWS Access Key ID [None]: Obtained when creating user in AWS IAM |
# Instructions from the app developer | |
# - you should use the 'node' official image, with the alpine 6.x branch | |
FROM node:latest | |
# - this app listens on port 3000, but the container should launch on port 80 | |
# so it will respond to http://localhost:80 on your computer | |
EXPOSE 1337 | |
# - then it should use alpine package manager to install tini: 'apk add --update tini' | |
# RUN apk add --update tini | |
# - then it should create directory /usr/src/app for app files with 'mkdir -p /usr/src/app' | |
RUN mkdir -p /usr/src/app |
var aws = require('aws-sdk') | |
var express = require('express') | |
var multer = require('multer') | |
var multerS3 = require('multer-s3') | |
var app = express() | |
var s3 = new aws.S3({ | |
accessKeyId: '', | |
secretAccessKey: '', | |
region: 'ap-southeast-1' |
version: 0.1 | |
# REQUIRED ENVIRONMENT VARIABLES | |
# AWS_KEY - AWS Access Key ID | |
# AWS_SEC - AWS Secret Access Key | |
# AWS_REG - AWS Default Region (e.g. us-west-2) | |
# AWS_OUT - AWS Output Format (e.g. json) | |
# AWS_PROF - AWS Profile name (e.g. central-account) | |
# IMAGE_REPO_NAME - Name of the image repo (e.g. my-app) | |
# IMAGE_TAG - Tag for the image (e.g. latest) |
version: 0.0 | |
os: linux | |
files: | |
- source: / | |
destination: /home/ec2-user/node | |
permissions: | |
- object: /home/ec2-user | |
owner: ec2-user | |
group: ec2-user | |
type: |
+-- app | |
| +-- bower.json | |
| +-- index.html | |
| +-- index.js | |
| +-- index.css | |
+-- gulpfile.js | |
+-- package.json | |
### STAGE 1: Build ### |
0002010102112926000910091704805091009170485802MM64060002my54030.05303MMK6231010100209100917048100910091704863040956 | |
/* | |
TagId | |
ValueLength | |
Value | |
*/ | |
00 [Payload Format Indicator - M] |