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
import org.junit.Test; | |
import com.fasterxml.jackson.dataformat.xml.XmlMapper; | |
import com.w3schools.Note; | |
public class Main { | |
@Test | |
public void test() throws Exception { | |
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
{ | |
"AWSTemplateFormatVersion": "2010-09-09", | |
"Parameters": { | |
"EmailAddressForNotificationParameter": { | |
"Description": "Email address for the notification", | |
"Type": "String" | |
} | |
}, | |
"Description": "Static website budget", | |
"Resources": { |
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
AWSTemplateFormatVersion: "2010-09-09" | |
Description: Lambda action cloudfront cache invalidation stack | |
Parameters: | |
Stage: | |
Type: String | |
AllowedValues: | |
- dev | |
- prod |
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
import boto3 | |
import os | |
code_pipeline = boto3.client("codepipeline") | |
cloud_front = boto3.client("cloudfront") | |
def lambda_handler(event, context): | |
print(event) | |
job_id = event["CodePipeline.job"]["id"] | |
try: |
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
export const handler = async (event, context, callback) => { | |
var olduri = event.Records[0].cf.request.uri; // search for the uri in cloudfront request | |
var host = event.Records[0].cf.request.headers.host.find(o => o.key === 'Host').value; // search for the host in the key-value headers | |
if (host.startsWith("www.")) { | |
const response = { | |
status: '301', | |
statusDescription: 'Moved Permanently', | |
headers: { | |
location: [{ | |
key: 'Location', |
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
{ | |
"AWSTemplateFormatVersion": "2010-09-09", | |
"Conditions": { | |
"AlterativeDomainNotPresent": { | |
"Fn::Equals": [ | |
"", | |
{ | |
"Ref": "AlternativeDomainNameParameter" | |
} |
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
AWSTemplateFormatVersion: "2010-09-09" | |
Description: Lambda@Edge function stack | |
Parameters: | |
Stage: | |
Type: String | |
AllowedValues: | |
- dev | |
- prod | |
Resources: | |
LambdaEdge: |
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
{ | |
"AWSTemplateFormatVersion": "2010-09-09", | |
"Parameters": { | |
"ArtifactS3BucketNameParameter": { | |
"Description": "Artifact S3 Bucket Name", | |
"Type": "String" | |
}, | |
"S3BucketNameParameter": { | |
"Description": "S3 Bucket Name", | |
"Type": "String" |
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
regions: | |
- us-east-1 | |
- global | |
account-blocklist: | |
- "1234567890" # don't nuke this | |
accounts: | |
"0123456789": {} #nuke this that has an alias, no filter |