Skip to content

Instantly share code, notes, and snippets.

View chrismckinnel's full-sized avatar

Chris McKinnel chrismckinnel

View GitHub Profile
{
"name": "lambda-redirect",
"version": "1.0.1",
"description": "Redirect lambda using Lambda@Edge and CloudFront",
"author": "Chris McKinnel",
"license": "MIT"
}
CloudFront:
Type: AWS::CloudFront::Distribution
Properties:
DistributionConfig:
DefaultCacheBehavior:
Compress: true
ForwardedValues:
QueryString: true
TargetOriginId: google-origin
ViewerProtocolPolicy: redirect-to-https
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Full stack to demo Lambda@Edge for CloudFront redirects
Parameters:
RedirectLambdaName:
Type: String
Default: redirect-lambda
Resources:
├── lambda-edge-prerequisites.yaml
├── lambda-edge.yaml
├── lambdas
│ ├── RedirectLambda.js
│ └── package.json
└── packaged
└── lambda-edge.yaml
├── .aws-sam
│ └── build
│ ├── RedirectLambda
│ │ ├── RedirectLambda.js
│ │ └── package.json
│ └── template.yaml
├── lambda-edge-prerequisites.yaml
├── lambda-edge.yaml
├── lambdas
│ ├── RedirectLambda.js
# Function to automatically call cfn-lint when deploying AWS CloudFormation templates
function aws() {
export COMMAND=$@
if [[ $COMMAND == cloudformation\ create-stack* ]] || [[ $COMMAND == cloudformation\ update-stack* ]];
then
while [[ $# -gt 0 ]]
do
key="$1"
Set fileSystemObject = CreateObject ("Scripting.FileSystemObject")
Set stdout = fileSystemObject.GetStandardStream (1)
Set stderr = fileSystemObject.GetStandardStream (2)
Function ExportAccessToCSV()
stdout.WriteLine "Exporting Access table " & table & " to CSV"
Dim database: database = WScript.Arguments(0)
Dim table: table = WScript.Arguments(1)
Set wshShell = WScript.CreateObject("WScript.Shell")