This course provides detail on the AWS Management & Governance services relevant to the AWS Certified Developer - Associate exam.
Want more? Try a lab playground or do a Lab Challenge!
Learning Objectives
- Learn how AWS AppConfig can reduce errors in configuration changes and prevent application downtime
- Understand how the AWS Cloud Development Kit (CDK) can be used to model and provision application resources using common programming languages
- Get a high-level understanding of Amazon CloudWatch
- Learn about the features and use cases of the service
- Create your own CloudWatch dashboard to monitor the items that are important to you
- Understand how CloudWatch dashboards can be shared across accounts
- Understand the cost structure of CloudWatch dashboards and the limitations of the service
- Review how monitored metrics go into an ALARM state
- Learn about the challenges of creating CloudWatch Alarms and the benefits of using machine learning in alarm management
- Know how to create a CloudWatch Alarm using Anomaly Detection
- Learn what types of metrics are suitable for use with Anomaly Detection
- Create your own CloudWatch log subscription
- Learn how AWS CloudTrail enables auditing and governance of your AWS account
- Understand how Amazon CloudWatch Logs enables you to monitor and store your system, application, and custom log files
- Explain what AWS CloudFormation is and what it’s used for
- Determine the benefits of AWS CloudFormation
- Understand what each of the core components are and what they are used for
- Create a CloudFormation Stack using an existing AWS template
- Learn what VPC flow logs are and what they are used for
- Determine options for operating programmatically with AWS, including the AWS CLI, APIs, and SDKs
- Learn about the capabilities of AWS Systems Manager for managing applications and infrastructure
- Understand how AWS Secrets Manager can be used to securely encrypt application secrets
In your default profile, you choose the default output for your commands. For example, if I run aws configure, and press enter until I get to output, I can then see that my default profile uses YAML as its default output.
For the output format, you can choose between 5 options: json, yaml, yaml-stream, text, and table. Generally, the JSON and YAML formats are best when working programmatically, as it interfaces well with programming languages. Text is best for scripting languages, table is best for humans looking to read this data, and YAML-stream is best for large data sets, as it provides a faster and more responsive output.
Let’s take a look at a few of these outputs.
I’ll first type in the command “aws ec2 describe-instances” to compare outputs. This command will list all instances in my default region, which is us-west-2. When I press enter, it provides the response in my chosen default format, which is YAML.
Now, let’s look at what happens when I specify the output. I’ll press q to exit out of the current response and clear my screen. Then, I’ll type in the same command, aws ec2 describe-instances and then I’ll use the –output parameter to change the output to JSON.
When I press enter, I can now see the output is in JSON. I can tell, because of these pesky little brackets. I won’t go through the rest of the outputs, but I encourage you to pause the video and change the output for this command to see the differences in all 5 of the formats.
Okay, welcome back. As you can see regardless of the output format, this command aws ec2 describe-instances spits out quite a bit of data. And if I only need specific details about my instances, then there may be a lot of unnecessary information here.
To reduce the amount of returned data, I can use the query argument by specifying –query in my command. The Query argument uses the JMESPath syntax which is a querying language for JSON. Here’s an example of what that looks like.
Let’s say I want to use the aws ec2 describe-instances command, but I only want to return the instance ID for every instance in this region. To do this, I can attach the –query parameter, and then I can use JMESPath syntax to say for all my reservations for all my ec2 instances I want just the Instance ID. It then returns a nice list of all the InstanceIds in my Region, so I don’t have to hunt through tons of returned data.
I can even attach –output to this command, and choose the table output to make this a bit more human-readable.
I can continue adding on to this command and return both the instanceId, and the Availability Zone of the instance if I’d like. First I’ll clear my screen, and then I’ll run the aws ec2 describe-instances command, and then I’ll look for Availability Zone. I can see that the AZ is one of three attributes under Placement. So when I select this attribute, I’ll refer to it as Placement.AvailabilityZone.
So let’s do this. I’ll use the same command as before, aws ec2 describe-instances –query ‘Reservations[*].Instance[*]. and then choose the fields I want. Since I’m selecting multiple fields, I’ll use curly braces this time and type in InstanceId.
Then, I’ll add a comma after InstanceId, and specify Placement.AvailabilityZone. I can also label each of these fields, so in front of instance-id, I can label this id: and in front of Placement.AvailabilityZone, I can label it as AZ:. I also want to update my output to be table. All right, and now you can see my table shows the ID and the AZ, each with column headers.
While query can help list fields you want returned, you can additionally filter data as well and reduce the amount of results you get back by specifying which resources you want to see.
For example, maybe I only want to return a list of instances that are in the us-west-2a Availability Zone. One thing to note is that the syntax for filters is a bit different. I usually go into the CLI reference to see what the list of filter options are. Here in the documentation I can see availability-zone is what I’m looking for. So, I’ll run the aws ec2 describe-instances command again and this time use the –filter command. This command starts with the quotes and then a Name field, and a Values field.
In this case, the Name will equal availability-zone, which we got from the filter options in the documentation, and the Values will equal us-west-2a.
So this limits my response down to the two instances that are in us-west-2a. If I wanted to go further, I can then query on this information. I’ll use the same command I just ran, then add on –query and say for all reservations, for all instances, I want the instance ID. Then it returns the instance ID for the two instances in us-west-2a.
That’s it for this one! See you next time.
Stuart has been working within the IT industry for two decades covering a huge range of topic areas and technologies, from data center and network infrastructure design, to cloud architecture and implementation.
To date, Stuart has created 150+ courses relating to Cloud reaching over 180,000 students, mostly within the AWS category and with a heavy focus on security and compliance.
Stuart is a member of the AWS Community Builders Program for his contributions towards AWS.
He is AWS certified and accredited in addition to being a published author covering topics across the AWS landscape.
In January 2016 Stuart was awarded ‘Expert of the Year Award 2015’ from Experts Exchange for his knowledge share within cloud services to the community.
Stuart enjoys writing about cloud technologies and you will find many of his articles within our blog pages.