We've released the Enterprise CLI for seamless deployments of Next.js projects on the AWS with complete IaC (Terraform) setup. Learn more
Blazity Logo
Deployments

Amazon Web Services

Learn about deployments of the next-enterprise boilerplate applications directly to the AWS Cloud

AWS provider features overview

  • Automated provisioning of AWS infrastructure
  • Scalable & secure setup using:
    • VPC
    • Elastic Container Service (ECS)
    • Elastic Container Registry (ECR)
    • Application Load Balancer
    • S3 + CloudFront for static assets
    • AWS WAF (Web Application Firewall)
    • Redis Cluster for caching
  • CI/CD (GitHub Actions) ready
    • Deploying the next-enterprise application
    • Deploying the Storybook
    • Destroying the stack

Getting started

Pre-installation checks

Make sure you have the enterprise-cli installed. Read more here

Pre-run environment checks

Ensure your current working directory is an actual next-enterprise boilerplate, alternatively, read more about next-enterprise installation process here

GitHub Auth

Confirm that you're correctly authenticated with GitHub CLI. You can quickly check this by running:

gh auth status

If you're not authenticated, you'll be prompted to do so by running:

gh auth login

and following the instructions.

Prepare the AWS Iac & CI/CD

enterprise prepare aws

Continue interaction with the CLI

Follow the instructions displayed in the terminal!. The result of successful prepare command should be freshly set up next-enterprise-based repository with all the CI/CD configuration and IaC (Terraform)

Actual deployment

Newly created GitHub repository -> Actions -> select one of the workflows (e.g. Deploy Stack) -> Run Workflow

Going forward - production environment

The enterprise-cli installs a pre-configured development environment. To create a production environment, follow these steps:

  1. Duplicate the Terraform Configuration

    • Copy the contents of the terraform/dev folder.
    • Rename the new folder to terraform/prod.
  2. Update Configuration References

    • Replace all occurrences of dev with prod.
    • Replace all occurrences of development with production.
  3. Create the Production Environment in GitHub

    • Go to your repository:
      Settings > Environments > New Environment
    • Name it production.
  4. Add Production Secrets Under Settings > Secrets and variables > Actions, and select the production environment, add the following secrets for the production AWS tenant:

    • AWS_ACCESS_KEY_ID
    • AWS_SECRET_ACCESS_KEY
  5. Add Production Environment Variables

    Add the following environment variables to the production environment:

    REDIS_URL=redis://next-enterprise-iac-prod-redis-cluster.example.amazonaws.com:6379
    S3_STORYBOOK_BUCKET_NAME=next-enterprise-iac-storybook-prod
  6. Duplicate CI/CD Pipelines

    • Copy the GitHub Actions workflows related to infrastructure and Storybook deployment.
    • Update:
      • Workflow names and environment references to production
      • Any file paths or settings that reference dev or development

This ensures the production environment is isolated and configured consistently with your development setup.

Visualization of the infrastructure

On this page