🚀

DevOps Project with AWS CodePipeline

Jun 28, 2024

DevOps Project with AWS CodePipeline

Introduction

Welcome

  • Exciting DevOps project focusing on CodePipeline.
  • Participants introduction and interaction.
  • Overview of the NexWORK community and access instructions for the project.

AWS Management Console

  • Logged in and ready to use AWS services.
  • Detailed project found under AWS projects: Cloud DevOps CI/CD with CodePipeline.

Project Overview

  • Part 7 of a DevOps series aimed at building and deploying a web app with CI/CD pipeline.
  • Previous services used: CodeCommit, CodeArtifact, CodeBuild, CodeDeploy.
  • CodePipeline integrates CodeCommit, CodeBuild, and CodeDeploy for automation.
  • Detailed explanation of CI/CD meaning continuous integration and continuous deployment.

Creating the CI/CD Pipeline

Prerequisites and Setup

  1. CloudFormation Templates

    • Templates automate the creation of AWS resources necessary for the project.
    • Recap of projects 1-6 and necessary tools (Maven, Java, etc.) installed in Cloud9 IDE.
    • Steps to deploy CloudFormation templates using AWS Management Console.
    • Verification of resources created by CloudFormation (S3 bucket, IAM Policies, CodeArtifact, etc.).
  2. Cloud9 Environment

    • Setup new EC2 instance for Cloud9 IDE.
    • Install Maven and Java using terminal commands.
    • Verify installations using appropriate terminal commands.
    • Create a skeleton Java web app using Maven archetypes.
    • Modify Index.jsp to personalize the web app.

Step-by-Step Project Work

  1. CodeCommit Repository

    • Skipping manual repository creation due to CloudFormation template.
    • Setting up Git identity and repository in Cloud9 via terminal commands.
    • Adding and committing changes; pushing to CodeCommit repository.
  2. CodeArtifact Configuration

    • Connect local workspace to CodeArtifact using connection instructions.
    • Configuring settings.xml file.
    • Compiling the application using Maven.
    • Verifying packages in CodeArtifact repository.
  3. IAM and S3 Bucket Setup

    • Created IAM policies and S3 bucket automatically by CloudFormation template.
    • Manual verification and additional setup if required.
  4. CodeBuild Setup

    • Editing CodeBuild project properties created by CloudFormation.
    • Creating and adding buildspec.yml and settings.xml to project files.
    • Executing the first build via CodeBuild Console.
    • Checking for successful builds and artifacts in S3 bucket.
  5. CodeDeploy Configuration

    • Create necessary scripts (install dependencies, start server, stop server).
    • Creating appspec.yml.
    • Configuration updates in buildspec.yml for code deployment.
    • IAM role setup for CodeDeploy.
    • CodeDeploy application and deployment group setup.
    • Successful deployment confirmation and viewing deployed web app.

Creating CodePipeline

Pipeline Configuration

  1. General Pipeline Settings

    • Naming the pipeline and choosing execution modes (superseded).
    • Role creation for pipeline execution.
  2. Configuring Stages

    • Source stage: CodeCommit repository settings.
    • Build stage: Configuring with CodeBuild project.
    • Deploy stage: Configuring with CodeDeploy application and deployment group.

Testing the Pipeline

  1. Release a Change

    • Edit source code (index.jsp and assets) in Cloud9 IDE.
    • Commit and push changes to CodeCommit.
    • Observe automatic build and deployment in CodePipeline.
    • Verify changes in the deployed web app.
  2. Trigger a Rollback

    • Using the rollback feature in CodePipeline to revert to a previous working state.
    • Verifying the rollback by viewing the reverted state of the web app.

Cleanup

  • Detailed steps to delete all AWS resources created to avoid incurring costs.
  • Challenge to remember and self-initiate deletion process if possible.

Conclusion

  • Successfully created and executed a CI/CD pipeline using AWS CodePipeline.
  • Automated integration between source, build, and deployment stages.
  • Importance of deleting unused resources and understanding IP address changes for security groups.

Additional Tips

  • Practical advice on understanding and not needing to memorize exact code.
  • Encouragement to share completed work and projects on NexWORK community and LinkedIn.

Key Learnings Page: Reflect upon personal learnings and unexpected aspects of the project.