Skip to main content

Account details

AWS Account ID: 170904582664
Region: eu-west-2 (London)

Services used

ServicePurpose
ECS (EC2 launch type)Runs app, nginx, and blackbox containers
ECRDocker image registry
S3File storage + environment configs
CloudWatchContainer logging
CodeBuildCI/CD build pipeline
IAMTask execution roles

ECS

Clusters

Two ECS services:
  • staging-app-ec2 — staging environment
  • production-app-ec2 — production environment

Task configuration

Each task runs 3 containers in bridge networking mode:
ContainerPortMemoryLinks
app (PHP-FPM)9000, 2525128 MBblackbox
nginx80 (prod) / 80+443 (staging)128 MBapp
blackbox3000128 MB

IAM roles

Task Role: arn:aws:iam::170904582664:role/ecsTaskExecutionRole
Execution Role: arn:aws:iam::170904582664:role/ecsTaskExecutionRole
Required capabilities:
  • ECR authentication (pulling images)
  • CloudWatch logging (awslogs driver)
  • S3 environment file loading
  • Task IAM role assumption

ECR

Registry: 170904582664.dkr.ecr.eu-west-2.amazonaws.com

Images

RepositoryDescription
tutorbloc.appPHP 7.2-FPM application
tutorbloc.app.nginxNginx reverse proxy
tutorbloc.blackboxDistance calculation microservice
redisRedis cache (mirrored from Docker Hub)

Tagging strategy

{image}:{environment}                → Latest for environment
{image}:{environment}-{build_number} → Specific build
Examples:
  • tutorbloc.app:production
  • tutorbloc.app:staging-42

S3

Bucket: tutorbloc-app

PathContent
env-configurations/staging/.envStaging environment variables
env-configurations/production/.envProduction environment variables
env-configurations/staging/APNS-Key.p8Apple push notification key
env-configurations/staging/AAACertificateServices.crtSSL certificate
User uploadsProfile images, videos, documents

Environment file loading

ECS tasks load .env from S3 at startup:
{
  "environmentFiles": [{
    "value": "arn:aws:s3:::tutorbloc-app/env-configurations/production/.env",
    "type": "s3"
  }]
}

CloudWatch

Log groups

GroupSource
/ecs/production-app-ec2All production containers
/ecs/staging-app-ec2All staging containers

Log configuration

{
  "logDriver": "awslogs",
  "options": {
    "awslogs-group": "/ecs/production-app-ec2",
    "awslogs-region": "eu-west-2",
    "awslogs-stream-prefix": "ecs"
  }
}
Each container (app, nginx, blackbox) has its own log stream within the group.

Application logging

Laravel logs are configured in config/logging.php:
ChannelDestinationRetention
stack (default)Uses daily channel
dailystorage/logs/laravel.log14 days
singlestorage/logs/laravel.log
stderrPHP stderr (→ CloudWatch)
slackSlack webhook
papertrailSyslog UDP
In Docker/ECS, stderr output is captured by CloudWatch. For production debugging, check both CloudWatch logs and the Laravel log files (if the storage volume persists).