This file contains hidden or 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
// lib/next-static-site.ts | |
// Next.js Static Hosting on S3 + CloudFront (CDK v2, TypeScript) | |
// - Next.js static export docs (App Router `"output": "export"`): https://nextjs.org/docs/app/guides/static-exports | |
// (Pages Router export: https://nextjs.org/docs/pages/guides/static-exports) | |
// - trailingSlash config (optional, helps generate `/route/`): https://nextjs.org/docs/app/api-reference/config/next-config-js/trailingSlash | |
// | |
// CloudFront + S3 bits: | |
// - Private S3 origins via OAI/OAC: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-restricting-access-to-s3.html | |
// - S3 Block Public Access (keep the bucket private): https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-control-block-public-access.html | |
// - CloudFront Function to append `/index.html` (official example): https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/example_cloudfront_functions_url_rewrite_single_page_apps_section.html |
This file contains hidden or 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
#!/bin/bash | |
# Load all environment variables from .env file into the system | |
# Check if .env file exists | |
if [ ! -f .env ]; then | |
echo "Error: .env file not found" | |
exit 1 | |
fi | |
# Read .env file line by line |
This file contains hidden or 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
hello world |
This file contains hidden or 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
#/bin/sh | |
#Tests if file can be reached with curl, then an ifelse to act upon this. | |
#Sends downloaded file to /dev/null so you don't need to deal with it | |
#Relies on curl being installed | |
#################################### | |
## Specify parameters for testing ## | |
test_URL='https://d1.awsstatic.com/logos/aws-logo-lockups/poweredbyaws/Powered-By_logo-horiz_RGB.87c70af8a8a34b68606524ade6261db083947a14.png' | |
desired_status_code=200 | |
#################################### |