@inizioevoke/evosynth
v1.7.1
Published
EvoSynth/EvoGen is an npm package providing reusable AWS CDK stacks for deploying static serverless websites. It targets S3 + CloudFront + Route53 + ACM + WAF + CodePipeline architectures.
Keywords
Readme
@inizioevoke/evosynth
EvoSynth/EvoGen is an npm package providing reusable AWS CDK stacks for deploying static serverless websites. It targets S3 + CloudFront + Route53 + ACM + WAF + CodePipeline architectures.
Prerequisites
- CDK v2.238.x
- Node version 22+
- AWS Account ID, a configured profile, or other credentials
- CodeConnection ARN or SSM Parameter Store path of a shared connection ARN
- A WAF web ACL ARN or SSM Parameter Store path of a shared ACL ARN
- The Bitbucket or GitHub repository
Project configuration
- Copy the buildspec.yml on your Bitbucket Repo and the build configuration
- Update/Configure the Stack example below
Example App
import * as cdk from 'aws-cdk-lib/core';
import { CloudFrontFunctionRedirects } from '@inizioevoke/evosynth/constructs/cloudfront';
import { WebStaticServerlessStage } from '@inizioevoke/evosynth/stages/web-static-serverless-stage';
import { AddSourceStageParams } from '@inizioevoke/evosynth/constructs/codepipeline';
const app = new cdk.App();
const env = getEnv('us-east-1');
// const env = getEnv('000000000000');
// const env = getEnv({ account: '000000000000', region: 'us-east-1' });
const tags: Record<string, string> = {
'Account': 'Account Name',
'Brand': 'Brand Name'
};
const repository: Omit<AddSourceStageParams, 'branch'> = {
codestarConnection: { path: '/evosynth/provider/codeconnection' },
// codestarConnection: 'ARN',
repoOwner: 'orgname',
repo: 'myproject-v1'
};
const redirects: CloudFrontFunctionRedirects = {
paths: {
'/hello': '/world',
'/redirect': ['/here', 302]
}
};
new WebStaticServerlessStage(app, 'dev', {
env,
stageName: 'myproject-v1-dev',
tags,
envType: 'NOT_PROD',
description: 'My Project DEV',
hostedZone: 'evodev.net',
domainName: 'myproject-v1.evodev.net',
basicAuth: { path: '/evosynth/web/security/basicauth' },
// basicAuth: {
// user: 'user',
// password: 'password'
// },
// basicAuth: 'dXNlcjpwYXNzd29yZA==',
webAcl: { path: '/evosynth/web/security/webacl' },
// webAcl: 'ARN',
// webAcl: true, // create new, but you probably should reuse one,
// Use a custom CloudFront Viewer Request/Response function
// viewerRequestResponse: 'function handler(event) { /* do something */ }',
redirects,
pipeline: {
sourceStage: {
...repository,
branch: 'develop'
},
// Grant read access to Parameter Store parameters
// codeBuildProject: {
// ssmParameters: [{
// path: '/my/parameter',
// encrypted: true
// }, {
// path: '/my/other/parameter'
// }]
// }
}
});
new WebStaticServerlessStage(app, 'uat', {
env,
stageName: 'myproject-v1-uat',
tags,
envType: 'NOT_PROD',
description: 'My Project UAT',
hostedZone: 'evostg.net',
domainName: 'myproject-v1.evostg.net',
basicAuth: { path: '/evosynth/web/security/basicauth' },
// basicAuth: {
// user: 'user',
// password: 'password'
// },
// basicAuth: 'dXNlcjpwYXNzd29yZA==',
webAcl: { path: '/evosynth/web/security/webacl' },
// webAcl: 'ARN',
// webAcl: true, // create new, but you probably should reuse one,
redirects,
pipeline: {
sourceStage: {
...repository,
branch: 'uat'
}
}
});
new WebStaticServerlessStage(app, 'prd', {
env,
stageName: 'myproject-v1-prd',
tags,
envType: 'PROD',
description: 'My Project PRD',
hostedZone: 'myproject.com',
domainName: 'www.myproject.com',
webAcl: { path: '/evosynth/web/security/webacl' },
// webAcl: 'ARN',
// webAcl: true, // create new, but you probably should reuse one
redirects,
pipeline: {
sourceStage: {
...repository,
branch: 'prod'
}
}
});Win
cdk deploy dev/*cdk deploy uat/*cdk deploy prd/*MacOS
cdk deploy "dev/*" cdk deploy "uat/*" cdk deploy "prd/*" 