Diagram 3 of 12

Automated deployment (CI/CD)

A code change triggers the pipeline. CodePipeline orchestrates the stages, CodeBuild installs dependencies, runs tests and generates the site, and the output is published to S3 with a CloudFront invalidation.

S3CodePipelineCodeBuildIAMCloudFrontGit and AWS CLI

Diagram

Diagram 3: automated deployment (CodePipeline + CodeBuild + S3 + CloudFront)AWS CloudDeveloper(git / AWS CLI)S3Amazon S3(source code)CPAWS CodePipeline(orchestration)CBAWS CodeBuild(build and tests)S3Amazon S3(HTML site)CFAmazon CloudFront(invalidation)IAMAWS IAM(build role)Users1234561. The developer pushes the code to the source S3 bucket (git push or AWS CLI).2. CodePipeline detects the change and runs the pipeline stages.3. CodeBuild installs dependencies, runs the tests and generates HTML, CSS and JS.4. The output is published to the site S3 bucket.5. The CloudFront cache is invalidated so users get the new version.6. Users access the site through CloudFront.

Comments

Information flow

  1. Amazon S3 (source code)

    The developer pushes the code with git push or AWS CLI to the source bucket.

  2. AWS CodePipeline

    CodePipeline detects the change and runs the pipeline stages in order.

  3. AWS CodeBuild

    CodeBuild installs dependencies, runs the tests and generates HTML, CSS and JS.

  4. Amazon S3 (HTML site)

    The result is published to the site bucket.

  5. Amazon CloudFront

    The CloudFront cache is invalidated so users receive the new version.

  6. Users

    Users access the site through CloudFront.