Skip to content

Instantly share code, notes, and snippets.

View kylegalbraith's full-sized avatar

Kyle Galbraith kylegalbraith

View GitHub Profile
View sample-app.js
import React from "react";
import {
ForgotPassword,
RequireNewPassword,
SignIn,
SignUp,
VerifyContact
} from "aws-amplify-react";
import config from "../../aws-exports";
import { Authenticator, Greetings } from "aws-amplify-react/dist/Auth";
@kylegalbraith
kylegalbraith / buildspec.yml
Created September 15, 2018 14:57
buildspec.yml with Client Headers and CloudFront invalidation
View buildspec.yml
version: 0.2
phases:
install:
commands:
- echo "install step"
pre_build:
commands:
- echo "pre_build step"
build:
commands:
@kylegalbraith
kylegalbraith / buildspec.yml
Last active April 27, 2023 12:20
buildspec.yml with CloudFront invalidation
View buildspec.yml
version: 0.2
phases:
install:
commands:
- echo "install step"
pre_build:
commands:
- echo "pre_build step"
build:
commands:
@kylegalbraith
kylegalbraith / cicd-pipeline-with-ecr.tf
Created August 23, 2018 20:32
A Terraform template to provision a CI/CD Pipeline in AWS with ECR integration
View cicd-pipeline-with-ecr.tf
variable "image_name" {
type = "string"
}
module "codecommit-cicd" {
source = "git::https://github.com/slalompdx/terraform-aws-codecommit-cicd.git?ref=master"
repo_name = "docker-image-build" # Required
organization_name = "kylegalbraith" # Required
repo_default_branch = "master" # Default value
aws_region = "us-west-2" # Default value
View extended_buildspec.yml
build:
commands:
- npm build
post_build:
commands:
- aws s3 sync --delete . "s3://<your-static-website-bucket>"
View buildspec.yml
version: 0.2
phases:
install:
commands:
- echo "install step"
pre_build:
commands:
- echo "pre_build step"
build:
commands:
@kylegalbraith
kylegalbraith / toc.md
Created March 24, 2018 17:07
How To Host, Secure, and Deliver Static Websites on Amazon Web Services Table of Contents
View toc.md

How To Host, Secure, and Deliver Static Websites on Amazon Web Services

  • Quit Getting Lost In The Sea Of Information
    • Learn AWS By Using It
    • A Brief History Lesson On AWS
    • The Problem To Be Solved While Learning
    • When The Dust Settles
  • Getting Setup With AWS
    • Getting Started With AWS
    • 3 Things You Need To Do Before Using Your New Account
  • Configuring Your CLI
View terraform-debug-output.log
2018/03/21 12:41:49 [INFO] Terraform version: 0.11.4 7878d66b386e5474102b5047722c2de2b3237278
2018/03/21 12:41:49 [INFO] Go runtime version: go1.10
2018/03/21 12:41:49 [INFO] CLI args: []string{"C:\\terraform\\terraform.exe", "apply", "-var", "packagePath=..\\code\\package.zip", "-var", "packageName=package.zip"}
2018/03/21 12:41:49 [DEBUG] Attempting to open CLI config file: C:\Users\Kyle.Galbraith\AppData\Roaming\terraform.rc
2018/03/21 12:41:49 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2018/03/21 12:41:49 [INFO] CLI command args: []string{"apply", "-var", "packagePath=..\\code\\package.zip", "-var", "packageName=package.zip"}
2018/03/21 12:41:49 [INFO] command: empty terraform config, returning nil
2018/03/21 12:41:49 [DEBUG] command: no data state file found for backend config
2018/03/21 12:41:49 [DEBUG] New state was assigned lineage "73a84d51-e1ec-4236-468b-f4a395545239"
2018/03/21 12:41:49 [INFO] command: backend initialized: <nil>
@kylegalbraith
kylegalbraith / main.tf
Created March 21, 2018 19:32
terraform 0.11.4 destroy
View main.tf
variable "region" { default = "us-west-2" }
variable "packagePath" { default = "code\\package.zip" }
variable "packageName" { default = "package.zip" }
locals {
packageFile = "${file("${path.module}\\${var.packagePath}")}"
}
provider "aws" {
View uniqid promise
var mongodb = require('mongodb'),
MongoClient = mongodb.MongoClient,
dbUrl = process.env.MONGOLAB_URI,
urlObj = {},
urlInserted = false,
ids;
function generateRandomId(currIds) {
var randomId = Math.floor(Math.random() * 10000);
if (currIds.indexOf(randomId) < 0) {