Exercise 2_ Logging
Exercise 2_ Logging
0]
Note
The exercises in this course will have an associated charge in your AWS account. In
this exercise, you will create the following resources:
This exercise includes instructions to delete all the resources that you created for
this exercise.
Exercise: Logging
In this exercise, you will use AWS Systems Manager to run commands. These commands
will use the grep utility to search Apache logs on the underlying instance. You will then
output these logs to Amazon CloudWatch.
2. In the AWS Management Console, choose Services, and search for and choose
CloudFormation.
5. In the Specify template page, select Upload a template file and select Choose file.
6. Upload the final_pipeline.yaml file by opening the directory where you downloaded
it, choosing the final_pipeline.yaml file, and choosing Open.
7. Choose Next.
11. At the bottom of the Review final-pipeline page, select I acknowledge that AWS
CloudFormation might create IAM resources with custom names and choose
Create stack.
Creating the stack can take some time to complete. Allow the stack to finish before you
continue to the next task.
4. In the Command document search box, enter script and press Enter. Wait for the
command document options to load.
5. Select AWS-RunShellScript.
You are looking for any 404 errors that occurred and are logged in the Apache log file.
7. In the Targets section, add a tag by keeping Specify instance tags selected,
entering the following values, and then choosing Add:
Tag key: Name
Tag value: CodePipelineBlog
8. Under Output options, configure the following settings.
Enable an S3 bucket: Clear this check box
Enable CloudWatch logs: Select this check box
Log group name: /runcommand/404-check
9. Choose Run.
In the Targets and outputs section, the status should eventually show as Success.
1. To see the log, you can drill down by choosing the instance under Instance ID and
then expanding Output.
You should see the 404 error log that was also in the output from the previous task.
Cleaning up
In this task, you delete the AWS resources that you created for this project.
© 2021 Amazon Web Services, Inc. or its affiliates. All rights reserved. This work may not be
reproduced or redistributed, in whole or in part, without prior written permission from Amazon
Web Services, Inc. Commercial copying, lending, or selling is prohibited. Corrections, feedback,
or other questions? Contact us at https://support.aws.amazon.com/#/contacts/aws-training. All
trademarks are the property of their owners.