What this will cover
- Host a static website at S3
- Redirect
www.website.com
towebsite.com
- Website can be an SPA (requiring all requests to return
index.html
) - Free AWS SSL certs
- Deployment with CDN invalidation
# -*- coding: utf-8 -*- | |
import logging | |
import os | |
import datetime | |
import time | |
class SingletonType(type): | |
_instances = {} |
# Copyright (c) 2018 Bao Nguyen <[email protected]> | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: | |
# | |
# The above copyright notice and this permission notice shall be included in all |
""" | |
Produces load on all available CPU cores. | |
Requires system environment var STRESS_MINS to be set. | |
""" | |
from multiprocessing import Pool | |
from multiprocessing import cpu_count | |
import time | |
import os |
2019/01/04 12:49:26 [INFO] Terraform version: 0.11.11 ac4fff416318bf0915a0ab80e062a99ef3724334 | |
2019/01/04 12:49:26 [INFO] Go runtime version: go1.11.1 | |
2019/01/04 12:49:26 [INFO] CLI args: []string{"/usr/local/bin/terraform", "apply"} | |
2019/01/04 12:49:26 [DEBUG] Attempting to open CLI config file: /root/.terraformrc | |
2019/01/04 12:49:26 [DEBUG] File doesn't exist, but doesn't need to. Ignoring. | |
2019/01/04 12:49:26 [INFO] CLI command args: []string{"apply"} | |
2019/01/04 12:49:26 [TRACE] module source: "git::https://github.com/cloudposse/terraform-aws-vpc.git?ref=master" | |
2019/01/04 12:49:27 [TRACE] module source: "git::https://github.com/cloudposse/terraform-aws-dynamic-subnets.git?ref=master" | |
2019/01/04 12:49:27 [TRACE] module source: "git::https://github.com/cloudposse/terraform-aws-ec2-autoscale-group.git?ref=master" | |
2019/01/04 12:49:27 [TRACE] module source: "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.3.3" |
This is quick howto for installing vault on AWS Linux, mostly to remind myself. At the end of this tutorial, you'll have a working vault server, using s3 for the backend, self signed certificates for tls, and supervisord to ensure that the vault server is always running, and starts on reboot.
First things first, let's set up an s3 bucket to use as the storage backend for our s3 instance.
From the AWS Mangement Console, go to the S3 console.
Click on the Create Bucket
button
#!/usr/bin/python | |
import sys | |
import random | |
import string | |
def random_string(length): | |
pool = string.letters + string.digits | |
return (''.join(random.choice(pool) for i in xrange(length))).lower() |
#!/bin/bash -e | |
# This scripts installs jq: http://stedolan.github.io/jq/ | |
JQ=/usr/bin/jq | |
curl https://stedolan.github.io/jq/download/linux64/jq > $JQ && chmod +x $JQ | |
ls -la $JQ |