Create a Pipeline using the AWS CodePipeline Console
In this demonstration, you’ll perform a simple walkthrough of a two-stage pipeline using the CodePipeline console. This is based on AWS’ Simple Pipeline Walkthrough. A screencast is provided below.
Using the AWS console is often the best way to get familiar with the concepts around any new AWS service. The console is also a good way to view the status of resource configuration and attributes. In posts on Provisioning AWS CodePipeline with CloudFormation and Mocking AWS CodePipeline pipelines with Lambda, you became familiar with how to automate the provisioning of pipelines in CodePipeline using CloudFormation – along with many other AWS resources. In this post, you’ll take a step back and go over the steps of manually creating a simple pipeline using the AWS console.
Create an application and deployment in CodeDeploy
To create an application and deployment, go to the AWS Console and launch the CodeDeploy service. Choose Sample Deployment and click Next Step.
On the next page, choose Amazon Linux as the Operating System, then choose your EC2 Key Pair from the drop down and you’ll want to keep the Name and CodeDeployDemo defaults for Tag Key and Value. Finally, click Launch Instances. You’ll need to wait several minutes while CodeDeploy launches a CloudFormation stack that provisions three EC2 instances and installs the CodeDeploy agent on each of these instances. Once the instances have been launched, click Next step.
Enter an Application Name (or just use the default name) and click Next step. Click Next step from the Revision page. From the Deployment Group page, accept the defaults and click Next step. From the Service Role page, select an IAM role with access to CodeDeploy resources (this should have been previously created when you launched the EC2 instances for CodeDeploy). Click Next step. Review the Deployment Configuration and click Next step. From the Review page, click Deploy Now.
Access the application deployed by CodeDeploy
By going through these steps, you will launch a deployment of a simple web application across three EC2 instances. Check the CodeDeploy console for deployment status. Once everything is successful, choose, click View All Instances and click on the one of the links in the in Instance ID column to bring up the EC2 console. From the details pane, copy the Public IP and paste it into your browser. You should see a page that says something similar to “Congratulations. This application was deployed using AWS CodeDeploy.”.
Upload an application distribution to S3
Next, you will download the CodePipeline/CodeDeploy application distribution by going to the link to the CodePipeline/CodeDeploy distribution provided in the Resources section in this post. Upload the zip file to an S3 bucket in your AWS account and make note of your bucket name and key as you will be using it when creating a pipeline in CodePipeline. Make sure you enable versioning on the S3 bucket by selecting Properties for the bucket, clicking on Versioning and then Enable Versioning.
Create a Pipeline
Once this is a complete, go to the CodePipeline console and click Create pipeline. Enter your pipeline name and click Next step. Choose Amazon S3 as the Source provider followed by the S3 Location of the location (e.g. s3://stelligent-tmp/aws-codepipeline-s3-aws-codedeploy_linux.zip where stelligent-tmp is the bucket name and aws-codepipeline-s3-aws-codedeploy_linux.zip is the key) where you uploaded the zip file located in GitHub. Click Next step. Choose No Build as the Build provider and click Next step. From the Beta page, choose AWS CodeDeploy as the Deployment provider and enter the Application name and Deployment group that you defined when create the sample CodeDeploy deployment. Click Next step.
Choose AWS-CodePipeline-Service as your IAM Role name (or another role that has proper access to the CodePipeline services) on the AWS Service Role page and click Next step. Review your pipeline and click Create pipeline.
Access the application deployed by CodeDeploy and orchestrated by CodePipeline
From the CodePipeline console you can monitor the stages and actions for this simple two-stage pipeline. Once it successfully completes, refresh the page where you copied the URL when setting up CodePipeline. You should see a message similar to “Congratulations! You have successfully created a pipeline that retrieved this source application from an Amazon S3 bucket and deployed it to three Amazon EC2 instances using AWS CodeDeploy.” You’ve successfully orchestrated a CodeDeploy deployment that deploy a simple application from an S3 bucket.
Delete your Pipeline
From the CodePipeline console, select the pipeline you created and click Edit. Then, click Delete and enter the name of the pipeline you’d like to delete. You can delete your CodeDeploy application and CloudFormation stacks as well.