Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/reds-skywalker/Lightpress/llms.txt

Use this file to discover all available pages before exploring further.

Lightpress stores its AWS infrastructure definitions as CloudFormation templates in the infraestructure/cloudformation/ directory. CloudFormation lets you treat infrastructure as code — each stack describes the AWS resources it manages, and you deploy or update it with a single CLI command. This approach makes environments reproducible and keeps infrastructure changes auditable alongside application code.

What CloudFormation provisions

Lightpress CloudFormation templates are designed to provision the AWS resources that support a microservices SaaS architecture. Depending on the templates you deploy, stacks can manage resources across the following service categories:
ECS clusters, ECS task definitions, ECS services, and ECR repositories for storing Docker images built by CodeBuild. Each microservice in microservices/ maps to its own ECS service.
VPCs, subnets, internet gateways, NAT gateways, security groups, and Application Load Balancers that route traffic to the appropriate microservice.
S3 buckets for static assets and build artifacts, and managed database resources for persistent microservice data.
IAM roles and policies that grant least-privilege access for ECS tasks, CodeBuild projects, and cross-service calls.
CodeBuild projects and any CodePipeline resources that automate the build and deployment workflow defined in buildspec.yml.

Deploying a stack

Use the aws cloudformation deploy command to create a new stack or update an existing one. The command is idempotent — if the stack already exists and the template has not changed, it completes without making any changes.
1

Configure the AWS CLI

Make sure the AWS CLI is configured with credentials that have permission to create and manage the resources in your template.
aws configure
Verify your identity before deploying:
aws sts get-caller-identity
2

Package the template (if it uses local references)

If your template references local files (such as nested stacks or Lambda function code), package it first to upload those artifacts to S3 and produce a deployable template.
aws cloudformation package \
  --template-file infraestructure/cloudformation/main.yaml \
  --s3-bucket your-artifacts-bucket \
  --output-template-file infraestructure/cloudformation/packaged.yaml
3

Deploy the stack

Run aws cloudformation deploy with your template file and stack name. Pass parameters using --parameter-overrides.
aws cloudformation deploy \
  --template-file infraestructure/cloudformation/packaged.yaml \
  --stack-name lightpress-production \
  --parameter-overrides \
      Environment=production \
      AppVersion=1.0.0 \
  --capabilities CAPABILITY_NAMED_IAM \
  --region us-east-1
The --capabilities CAPABILITY_NAMED_IAM flag is required when your template creates named IAM resources.
4

Monitor the deployment

Track stack events in real time from the AWS Management Console, or poll with the CLI:
aws cloudformation describe-stack-events \
  --stack-name lightpress-production \
  --query "StackEvents[*].[Timestamp,LogicalResourceId,ResourceStatus]" \
  --output table
Wait for the stack to reach a stable state:
aws cloudformation wait stack-create-complete \
  --stack-name lightpress-production
5

Verify stack outputs

After a successful deployment, retrieve the stack outputs to get resource identifiers such as load balancer URLs and ECR repository URIs:
aws cloudformation describe-stacks \
  --stack-name lightpress-production \
  --query "Stacks[0].Outputs" \
  --output table

Stack parameters

Pass configuration values to your templates using --parameter-overrides. Common parameters for Lightpress stacks:
ParameterDescriptionExample
EnvironmentDeployment environmentproduction, staging
AppVersionApplication version tag1.0.0, main-abc1234
VpcCidrCIDR block for the VPC10.0.0.0/16
DesiredCountNumber of ECS task replicas2
DBInstanceClassRDS instance typedb.t3.micro
For a full list of parameters, inspect the Parameters section of each template file in infraestructure/cloudformation/.

Updating a stack

Use the same aws cloudformation deploy command to update an existing stack. CloudFormation computes a change set — a diff between the current and desired state — and applies only the required changes.
aws cloudformation deploy \
  --template-file infraestructure/cloudformation/packaged.yaml \
  --stack-name lightpress-production \
  --parameter-overrides \
      Environment=production \
      AppVersion=1.1.0 \
  --capabilities CAPABILITY_NAMED_IAM
Review the change set before applying it in production by running aws cloudformation create-change-set first and inspecting the proposed changes.

Rollback behavior

If a stack update fails, CloudFormation automatically rolls back all changes in the update to the last known stable state. You can monitor rollback progress the same way you monitor deployments:
aws cloudformation describe-stack-events \
  --stack-name lightpress-production \
  --query "StackEvents[?contains(ResourceStatus, 'ROLLBACK')][Timestamp,LogicalResourceId,ResourceStatus,ResourceStatusReason]" \
  --output table
Some resource types — such as RDS databases with deletion protection enabled — can block rollback. Resolve the blocking condition manually before CloudFormation can complete the rollback.

Deleting a stack

Deleting a stack removes all the resources it manages. This action is destructive and cannot be undone for stateful resources like databases and S3 buckets unless you have backups.
aws cloudformation delete-stack \
  --stack-name lightpress-production
Wait for deletion to complete:
aws cloudformation wait stack-delete-complete \
  --stack-name lightpress-production
Deleting a production stack removes databases, S3 buckets, and all associated data unless those resources have DeletionPolicy: Retain set in the template. Verify your templates before running delete-stack against a production environment.

Build docs developers (and LLMs) love