AWS Deployment

Deploy to Amazon Web Services with support for ECS, Lambda, EC2, Fargate, and more. Export Terraform configurations for infrastructure as code.

Setup Time

~10 minutes

Complexity

Medium

Best For

Enterprise & Scale

Overview

AWS offers the most comprehensive cloud platform with services for every use case. QODRYX simplifies AWS deployments by providing pre-configured deployment targets and Terraform export for infrastructure as code workflows.

Deployment Options

ECS / Fargate

Managed container orchestration with automatic scaling. Best for containerized applications.

Recommended

Lambda

Serverless functions with automatic scaling. Best for event-driven and API workloads.

Serverless

EC2

Virtual machines with full control. Best for legacy apps or specific requirements.

Full Control

App Runner

Fully managed container service. Best for simple web applications.

Simple

Prerequisites

  • An AWS account with appropriate permissions
  • AWS credentials (Access Key ID and Secret Access Key)
  • A Docker image or deployable application

Step 1: Connect AWS

Configure AWS credentials in QODRYX:

Terminal
# Set AWS credentials
qodryx secrets set AWS_ACCESS_KEY_ID your-access-key
qodryx secrets set AWS_SECRET_ACCESS_KEY your-secret-key
qodryx secrets set AWS_REGION us-east-1

# Or use IAM role (recommended for EC2/ECS)
qodryx config set aws.use_instance_role true

IAM Best Practices

Use IAM roles with least-privilege permissions. Avoid using root account credentials. Consider AWS Organizations for multi-account setups.

ECS / Fargate Deployment

Deploy containerized applications to ECS with Fargate (serverless containers):

qodryx.config.yaml
deployment:
  provider: aws
  service: ecs
  
  # ECS Configuration
  ecs:
    cluster: my-cluster
    service: my-app
    
    # Use Fargate (serverless)
    launch_type: FARGATE
    
    # Task definition
    task:
      cpu: 256        # 0.25 vCPU
      memory: 512     # 512 MB
      
      # Container settings
      container:
        name: app
        port: 3000
        healthcheck:
          path: /api/health
          interval: 30
          
    # Auto-scaling
    scaling:
      min: 1
      max: 10
      target_cpu: 70
      target_memory: 80
      
    # Networking
    networking:
      vpc: vpc-123456
      subnets:
        - subnet-abc123
        - subnet-def456
      security_groups:
        - sg-123456
        
    # Load balancer
    load_balancer:
      type: application
      listener_port: 443
      health_check_path: /api/health

Lambda Deployment

Deploy serverless functions to AWS Lambda:

qodryx.config.yaml
deployment:
  provider: aws
  service: lambda
  
  lambda:
    # Function configuration
    function_name: my-api
    runtime: nodejs20.x
    handler: index.handler
    
    # Resources
    memory: 256      # MB
    timeout: 30      # seconds
    
    # Environment variables
    environment:
      NODE_ENV: production
      DATABASE_URL: "{{secrets.DATABASE_URL}}"
      
    # API Gateway (optional)
    api_gateway:
      enabled: true
      type: HTTP  # or REST
      cors: true
      custom_domain: api.myapp.com
      
    # Layers (optional)
    layers:
      - arn:aws:lambda:us-east-1:123456:layer:my-layer:1
      
    # VPC (optional, for RDS access)
    vpc:
      subnets:
        - subnet-abc123
      security_groups:
        - sg-123456

EC2 Deployment

Deploy to EC2 instances with SSH:

qodryx.config.yaml
deployment:
  provider: aws
  service: ec2
  
  ec2:
    # Instance configuration
    instance_type: t3.medium
    ami: ami-0123456789abcdef0
    
    # SSH key for access
    key_name: my-key-pair
    
    # Security
    security_groups:
      - sg-123456
      
    # Deployment settings
    deploy:
      method: ssh
      user: ubuntu
      directory: /var/www/app
      
      # Pre-deploy commands
      before:
        - sudo systemctl stop app
        
      # Post-deploy commands
      after:
        - npm install --production
        - npm run migrate
        - sudo systemctl start app
        
    # Health check
    healthcheck:
      url: http://localhost:3000/health
      retries: 5

Container Registry (ECR)

Push Docker images to Amazon ECR:

qodryx.config.yaml
docker:
  registry: aws
  
  aws:
    region: us-east-1
    repository: my-app
    
    # Automatically create repository if missing
    create_repository: true
    
    # Image scanning
    image_scanning:
      scan_on_push: true
      
    # Lifecycle policy (cleanup old images)
    lifecycle:
      expire_untagged_after: 7  # days
      keep_last: 10             # tagged images

Terraform Export

Export your infrastructure as Terraform code:

Terminal
# Export Terraform configuration
qodryx export terraform --provider aws

# Export to specific directory
qodryx export terraform --provider aws --output ./infrastructure

# Export with modules
qodryx export terraform --provider aws --modules

# Generated files:
# infrastructure/
# ├── main.tf
# ├── variables.tf
# ├── outputs.tf
# ├── ecs.tf
# ├── ecr.tf
# ├── alb.tf
# └── vpc.tf

Deployment Commands

Terminal
# Deploy to ECS
qodryx deploy --provider aws --service ecs

# Deploy Lambda function
qodryx deploy --provider aws --service lambda

# Deploy to specific environment
qodryx deploy --provider aws --env production

# View deployment status
qodryx status --provider aws

# Rollback to previous version
qodryx rollback --provider aws

# View logs
qodryx logs --provider aws --service my-app --follow

AWS-Specific Features

ECS / Fargate

Managed container orchestration

Lambda

Serverless functions

ECR Integration

Container registry with scanning

Terraform Export

Infrastructure as code

Auto-Scaling

CPU and memory based scaling

CloudWatch

Logs and metrics integration

Troubleshooting

Permission Errors

  • Verify IAM user/role has required permissions
  • Check trust relationships for cross-account access
  • Enable CloudTrail to debug permission issues

ECS Task Failures

  • Check CloudWatch logs for container errors
  • Verify task role has permissions for secrets/services
  • Ensure sufficient CPU/memory allocation

Lambda Timeouts

  • Increase timeout in configuration
  • Check if Lambda needs VPC access
  • Optimize cold start with provisioned concurrency