trypost/cdk
vickytechkey c899d7db13
All checks were successful
Setup EC2 Tools / setup-server (push) Successful in 2m40s
chore: add missing AWS CDK and project dependencies to node_modules
2026-09-10 22:50:11 +05:30
..
.gitignore chore: add missing AWS CDK and project dependencies to node_modules 2026-09-10 22:50:11 +05:30
app.ts chore: add missing AWS CDK and project dependencies to node_modules 2026-09-10 22:50:11 +05:30
cdk.json chore: add missing AWS CDK and project dependencies to node_modules 2026-09-10 22:50:11 +05:30
package-lock.json chore: add missing AWS CDK and project dependencies to node_modules 2026-09-10 22:50:11 +05:30
package.json chore: add missing AWS CDK and project dependencies to node_modules 2026-09-10 22:50:11 +05:30
README.md chore: add missing AWS CDK and project dependencies to node_modules 2026-09-10 22:50:11 +05:30
trypostmedia-stack.ts chore: add missing AWS CDK and project dependencies to node_modules 2026-09-10 22:50:11 +05:30
tsconfig.json chore: add missing AWS CDK and project dependencies to node_modules 2026-09-10 22:50:11 +05:30

Trypost Media AWS CDK Stack

This CDK stack sets up the AWS cloud infrastructure for media asset hosting for Trypost:

  1. S3 Bucket (trypostmedia):
    • Secure private bucket with BlockPublicAccess.BLOCK_ALL and BucketEncryption.S3_MANAGED
    • Configured CORS headers for web uploads and downloads
    • SSL enforced (enforceSSL: true)
  2. CloudFront Distribution:
    • Integrated with S3 using modern Origin Access Control (OAC)
    • HTTPS redirect policy
    • Optimized caching policy and CORS security response headers
    • Generates the CloudFront URL for distribution
  3. CloudFormation Outputs:
    • BucketName: Name of the S3 bucket (trypostmedia)
    • DistributionDomainName & DistributionUrl: CloudFront CDN endpoint to use in .env (AWS_URL)

Deployment Instructions

1. Install Dependencies

Navigate to this directory and install dependencies:

cd cdk
npm install

2. Configure AWS Credentials

Ensure your AWS credentials and region are configured:

export AWS_ACCESS_KEY_ID="<your-access-key-id>"
export AWS_SECRET_ACCESS_KEY="<your-secret-access-key>"
export AWS_DEFAULT_REGION="ap-south-2"

3. Synthesize and Review CloudFormation Template

npx cdk synth

4. Deploy Stack

npx cdk deploy

Deployed Stack Details (ap-south-2)

  • Bucket ARN: arn:aws:s3:::trypostmedia
  • Bucket Name: trypostmedia
  • Distribution ID: E1R40XT0UHR7NK
  • Distribution Domain: d28qhqo5myc2wf.cloudfront.net
  • Distribution URL: https://d28qhqo5myc2wf.cloudfront.net

Laravel .env Configuration

Configure your Laravel .env with the deployed outputs:

FILESYSTEM_DISK=s3
AWS_ACCESS_KEY_ID=<your-iam-access-key>
AWS_SECRET_ACCESS_KEY=<your-iam-secret-key>
AWS_DEFAULT_REGION=ap-south-2
AWS_BUCKET=trypostmedia
AWS_URL=https://d28qhqo5myc2wf.cloudfront.net