Putting it all together

With the pipeline all set up, you can now test the entire setup as one cohesive solution!

First up, ensure that there are no errors in either of the stages during the deployments. In case there are any errors, simply select the particular error link provided in the stage and follow it back to its source, which can be anywhere from issues in CodeCommit to even the setting up of CodeDeploy. Here's a screenshot of the pipeline that we created using an accumulation of all of the preceding sections:

Here, you can choose to add more stages to your pipeline by simply selecting the Edit option, as highlighted earlier. Additionally, you can also view your pipeline's execution history by selecting the View pipeline history option.

In the Edit pipeline page, you can choose to add one or more stages to your pipeline as you see fit. Simply select the + Stage option provided at the end of each existing stage. This will bring up a new dialog where you can specify the stage's Name as well as define one or more actions.

Consider the following use case where we need to add an approval step before the code actually gets pushed into the staging area. In that case, we need to add a new stage between the existing Source and Staging stages:

  1. Click on the + Stage option and provide a suitable name for this new stage. Next, select the + Action option to add the rules for setting up the approval process.
  2. In the Add action dialog box, start by selecting the type of action from the Action category drop-down list. The following list of actions can be added to a stage: Approval, Source, Build, Test, Deploy, and Invoke. For this use case, select Approval:
  1. Fill in a suitable Action name and select an appropriate Action type as well. At present, only a Manual approval configuration option is provided by CodePipeline.
  1. Finally, select either one of a pre-existing SNS topics using the SNS topic ARN field and click on Add action once completed.
  2. With the new stage added, click on Save pipeline changes to commit the change. You should have a new stage added and visible in your pipeline, as shown in the following screenshot:
  1. Once the Source stage is prepped, the pipeline automatically halts at the Approval stage, as depicted in the following screenshot. Here, you can approve the process by simply selecting the Review option and then selecting the approval command. Doing so initiates the final Staging stage which invokes the CodeDeploy service to deploy the WordPress code over to our awaiting EC2 instance:

After a few minutes, the application is successfully uploaded on the instance and is up and running as well. You can verify this by making a note of your instances public IP address and typing in the following URL on a browser:

http:///WordPress/wp-admin/index.php

Remember to prefix WordPress in your URL since the AppSpec file clearly pointed to the root of the application at the /var/www/html/WordPress directory and not at /var/www/html itself.

In this way, you can easily leverage and automate the deployments of your application code using the AWS Code Suite of services! Amazing isn't it? But that's not all folks! There is a ton of other fascinating things that I would like you to learn and explore, all covered in the next section itself.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset