Giter Site home page Giter Site logo

amazon-redshift-devops-blog's Introduction

Amazon Redshift Devops

This repository contains sample code for the AWS Blog Post Applying CI/CD DevOps Principles to Amazon Redshift Development.

High Level Architecture

Architecture

Components

This demo uses the following components to enable CI/CD of Redshift Stored Procedures and schema changes.

  • AWS CodePipeline to do the overall orchestration.
  • AWS CodeCommit as the version control system.
  • AWS CodeBuild as the execution environment for Apache Maven.
  • AWS Secrets Manager to store the Redshift connection parameters.

The application uses Apache Maven with Flyway for database migrations and JUnit for unit testing.

The demo also provides 2 types of buildspec file:

  • buildspec_test.yml for the testing phase
  • buildspec_prod.yml for the deployment phase

Deploying the Example App

Clone the GitHub Repository

The AWS CloudFormation template and the source code for the example application can be found here: https://github.com/aws-samples/amazon-redshift-devops-blog. Before you get started, you need to clone the repository using the following command:

git clone https://github.com/aws-samples/amazon-redshift-devops-blog

This will create a new folder, amazon-redshift-devops-blog, with the files inside.

Deploy CloudFormation Template

Go to the CloudFormation console and click “Create Stack” then choose “With new resources (standard)”.

Once you’re in the “Create stack” page, choose “Upload a template file” and then “Choose file”. The file should be in <cloned_directory>/cloudformation_template.yml. After you select the file, your screen should look like the following:

Deploy Step 1

Click “Next” and complete the parameters.

Deploy Step 2

Click "Next"

Deploy Step 3

We can leave everything as is in this page and click “Next”.

Deploy Step 4

Lastly, scroll to the bottom of the page and check the acknowledgement and click “Create stack”. The stack will create the VPC, Redshift clusters, CodeCommit repository, CodeBuild projects for both test and prod, and lastly the pipeline using CodePipeline to orchestrate the change release process.

Deploy Step 5

Click the refresh button on the top right corner to track the progress of the stack creation.

Push Code to the CodeCommit Repository

Once the stack creation has completed, go to the CodeCommit console and you’ll find the redshift-devops-repo repository that CloudFormation created. Clicking on the repo name will take you to the following screen:

Deploy Step 6

Before you can push any code into this repo, follow the steps outlined in the CodeCommit documentation. Once you reached Step 4, copy the HTTPS URL, and instead of cloning, we would be adding the CodeCommit repo URL into the code that we cloned earlier by doing the following steps:

git remote add codecommit <repo_https_url> 
git push codecommit main

The last step will populate the repository and you can confirm it by refreshing the CodeCommit console. If you get prompted for username and password, input the Git credentials that you generated and downloaded from Step 3.

CI/CD Pipeline

Once you pushed the code into the CodeCommit repository in the previous step, this will trigger the CodePipeline to deploy the code into both the test and prod Redshift clusters. You can monitor the progress using the CodePipeline console. Your screen should look something like this:

Deploy Step 7

You can dive deeper into the progress of the “build” by clicking on the details link as indicated in the screenshot above. This will take you to CodeBuild where you can see the execution logs as well as the result of the testing via Test Reports.

Clean Up

After you’re done, it’s crucial to tear down the environment to avoid incurring additional charges beyond your testing. Before you delete the CloudFormation stack. Go to the “Resources” tab of your stack and make sure the 2 S3 buckets that were provisioned are empty. If they’re not empty, it’s safe to delete all the contents of the bucket. Example:

Deploy Step 8

You can search for “s3” and click the associated links to go to the bucket directly. Once the buckets are empty. Click the delete button to tear down the stack and delete all the provisioned resources.

Security

See CONTRIBUTING for more information.

License

This library is licensed under the MIT-0 License. See the LICENSE file.

amazon-redshift-devops-blog's People

Contributors

amazon-auto avatar asramaa avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.