3.1.2 Directory Structure

Application Directory Structure

SAM Project

my-sam-app/
├── template.yaml          # SAM template (CloudFormation extended)
├── samconfig.toml         # SAM CLI config (stack name, region, etc.)
├── src/
│   └── handlers/
│       ├── get_order.py
│       └── create_order.py
├── tests/
│   ├── unit/
│   └── integration/
└── events/                # Sample test events
    └── event.json

Elastic Beanstalk

my-eb-app/
├── .ebextensions/         # Configuration files (YAML/JSON)
│   ├── 01-packages.config # Install OS packages
│   └── 02-env.config      # Environment settings
├── .platform/
│   └── hooks/
│       ├── prebuild/      # Before build
│       └── postdeploy/    # After deploy
├── Procfile               # Process definitions
├── requirements.txt
└── application.py

.ebextensions Example

# .ebextensions/01-env.config
option_settings:
  aws:elasticbeanstalk:application:environment:
    DB_HOST: mydb.abc123.us-east-1.rds.amazonaws.com
    STAGE: production

ECS/Docker

my-ecs-app/
├── Dockerfile
├── docker-compose.yml     # Local development
├── buildspec.yml          # CodeBuild
├── taskdef.json           # ECS Task Definition
├── appspec.yaml           # CodeDeploy (Blue/Green)
└── src/
    └── app.py

Exam Tip: .ebextensions/ cho Beanstalk config. template.yaml cho SAM. buildspec.yml cho CodeBuild. appspec.yml cho CodeDeploy. taskdef.json cho ECS.