# aws-samples/aws-codedeploy-samples architecture

> Architecture diagram of the GitHub repository aws-samples/aws-codedeploy-samples, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aws-samples/aws-codedeploy-samples
- Repository: https://github.com/aws-samples/aws-codedeploy-samples

## Overview

##### Project type and purpose
- This repository is not a single runtime application but a collection of AWS CodeDeploy samples and integrations.
- It demonstrates:
– Sample web applications (Linux & Windows)
– Configuration-management integrations (Ansible, Chef, Puppet, Salt)
– Load-balancer hooks (Elastic Load-Balancing v1 & v2)
– Version-control hook (Git pre-push)
– A utility for STS credentials

##### File structure
- Top-level directories:
– applications/ → standalone sample apps, each with its own appspec.yml, deploy hooks, index.html
– conf-mgmt/ → integrations for four CM systems, each contains module/role definitions, playbooks/cookbooks/manifests
– load-balancing/ → scripts to register/deregister EC2 instances with ELBs and ELBv2 during deploy hooks
– utilities/ → STS credentials helper (Ruby gem structure)
– version-control/ → Git hook example (pre-push script)
- Common pattern: each scenario provides an appspec.yml plus lifecycle hooks or recipes to plug into CodeDeploy

##### Extract insights from the README
- The purpose is purely educational: show how to wire AWS CodeDeploy to various deployment and environment-configuration technologies
- No single runtime component—focus is on the deploy pipeline and hook extensibility

##### Detail
– Break down each lifecycle phase and list which hook or CM tool runs there
– Show that each scenario folder is a self-contained deployment unit
– Capture external dependencies (e.g., IAM via STS, ELB endpoints)
– Don’t hesitate to sub-divide the “conf-mgmt” block into four sub-blocks for Ansible, Chef, Puppet, and Salt

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Developer and Tools
    Dev["Developer Workstation"]:::actor
    GitCLI["Git CLI"]:::actor
    STSHelper["STS Credentials Helper"]:::utility
    Dev --> GitCLI
    Dev --> STSHelper
    STSHelper -->|"calls"| STS["AWS STS"]:::aws

    %% Version-Control Hook
    PrePush["Git Pre-Push Hook"]:::vc
    GitCLI --> PrePush
    click PrePush "https://github.com/aws-samples/aws-codedeploy-samples/tree/master/version-control/git/pre-push"

    %% Repository and Orchestration
    Repo["Git Repository"]:::storage
    CodeDeploy["AWS CodeDeploy"]:::aws
    GitCLI --> Repo
    CodeDeploy --> Repo
    GitCLI --> CodeDeploy

    %% CodeDeploy to Instances
    CodeDeploy -->|"deploy artifacts & hooks"| Instances["EC2 Instances"]:::compute

    %% Sample Applications
    subgraph "Sample Applications" 
        direction TB
        SampleLinux["Sample App (Linux)"]:::app
        SampleWindows["Sample App (Windows)"]:::app
    end
    CodeDeploy --> SampleLinux
    CodeDeploy --> SampleWindows
    click SampleLinux "https://github.com/aws-samples/aws-codedeploy-samples/tree/master/applications/SampleApp_Linux/"
    click SampleWindows "https://github.com/aws-samples/aws-codedeploy-samples/tree/master/applications/SampleApp_Windows/"

    %% Configuration Management Integrations
    subgraph "Configuration Management" 
        direction TB
        Ansible["Ansible Integration"]:::cm
        ChefSolo["Chef Solo Integration"]:::cm
        ChefAgent["Chef Agent Cookbook"]:::cm
        PuppetModule["Puppet Module"]:::cm
        PuppetMasterless["Puppet Masterless"]:::cm
        Salt["SaltStack Integration"]:::cm
    end
    CodeDeploy --> Ansible
    CodeDeploy --> ChefSolo
    CodeDeploy --> ChefAgent
    CodeDeploy --> PuppetModule
    CodeDeploy --> PuppetMasterless
    CodeDeploy --> Salt
    click Ansible "https://github.com/aws-samples/aws-codedeploy-samples/tree/master/conf-mgmt/ansible/local-only/"
    click ChefSolo "https://github.com/aws-samples/aws-codedeploy-samples/tree/master/conf-mgmt/chef/solo/"
    click ChefAgent "https://github.com/aws-samples/aws-codedeploy-samples/tree/master/conf-mgmt/chef/aws-codedeploy-agent/"
    click PuppetModule "https://github.com/aws-samples/aws-codedeploy-samples/tree/master/conf-mgmt/puppet/aws-codedeploy/"
    click PuppetMasterless "https://github.com/aws-samples/aws-codedeploy-samples/tree/master/conf-mgmt/puppet/masterless/"
    click Salt "https://github.com/aws-samples/aws-codedeploy-samples/tree/master/conf-mgmt/salt/local-only/"

    %% Load Balancing Hooks
    subgraph "Load Balancing Hooks"
        direction TB
        ELB1["ELB v1 Hooks"]:::lb
        ELB2["ELB v2 Hooks"]:::lb
    end
    CodeDeploy --> ELB1
    CodeDeploy --> ELB2
    click ELB1 "https://github.com/aws-samples/aws-codedeploy-samples/tree/master/load-balancing/elb/"
    click ELB2 "https://github.com/aws-samples/aws-codedeploy-samples/tree/master/load-balancing/elb-v2/"
    ELB1 -->|"register/deregister"| ELBService["AWS ELB"]:::aws
    ELB2 -->|"register/deregister"| ELB2Service["AWS ELBv2"]:::aws

    %% Utility
    UtilGem["STS Helper Gem"]:::utility
    Dev --> UtilGem
    click UtilGem "https://github.com/aws-samples/aws-codedeploy-samples/tree/master/utilities/aws-codedeploy-session-helper/"

    %% Instances and Hooks Execution
    subgraph "Target EC2 Instances" 
        direction TB
        Hooks["Lifecycle Hooks"]:::hooks
        CMAgents["CM Agents & Scripts"]:::compute
    end
    CodeDeploy --> Hooks
    Hooks --> CMAgents
    CMAgents -->|"exec hooks"| AppServer["Web Server"]:::compute

    %% AWS Services
    subgraph "AWS Managed Services"
        direction TB
        CodeDeploy
        STS
        ELBService
        ELB2Service
    end

    %% Styles
    classDef actor fill:#f9f,stroke:#333,stroke-width:1px
    classDef aws fill:#bbf,stroke:#333,stroke-width:1px
    classDef storage fill:#eef,stroke:#333,stroke-width:1px
    classDef compute fill:#ddd,stroke:#333,stroke-width:1px
    classDef app fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef cm fill:#d4edda,stroke:#333,stroke-width:1px
    classDef lb fill:#ffe5b4,stroke:#333,stroke-width:1px
    classDef utility fill:#e2d4f0,stroke:#333,stroke-width:1px
    classDef vc fill:#d1d1d1,stroke:#333,stroke-width:1px
    classDef hooks fill:#f8d7da,stroke:#333,stroke-width:1px
```
