Lab complete!
Now that you have completed this lab, make sure to update your Well-Architected review if you have implemented these changes in your workload.
Click here to access the Well-Architected Tool
We have a CloudWatch dashboard to show us CPU and Memory statistics for the deployed EC2 instance. In order to showcase the dashboards, lets add a synthetic load to the machine. We have 2 PowerShell scripts that have already been deployed to the instance to facilitate this.
This script will start multiple threads (one per CPU in the machine) to keep the processor busy doing a simple math computation. We set the thread priority to “Lowest” so it should still allow system processes to continue.
This script will create an ever expanding array in RAM to attempt to consume as much as possible. We do reserve 512Mb of ram for the OS to continue to operate.
Open a new tab for the AWS console with this link: https://console.aws.amazon.com/ec2/v2/home?r#Instances:instanceState=running;tag:Name=WindowsMachineDeploy
You should see the EC2 instance we have deployed.
Click the checkbox next to the machine, and then click “Connect”
Select “Session Manager” and then click Connect. This will open a new tab with a PowerShell console for the instance.
Type C:\mem_stress.ps1 at the console and it will start to consume memory resources
Go back to the previous broswer tab that has the EC2 console connect screen and click Connect again. This will open another PowerShell console.
Type C:\cpu_stress.ps1 at the console and it will start to consume CPU resources
Go back to your browser tab that contains the CloudWatch Dashboard. You should see the CPU and Memory graphs change within 10-15 seconds.
As time goes on, it will continue to update the graph. In order to remove the load, go back to each of the console windows and simply press any key. This will cause the script to reclaim all resources it has consumed.
Go back to your browser tab that contains the CloudWatch Dashboard to watch as the CPU load goes down and the amount of free RAM increases.
Now that you have completed this lab, make sure to update your Well-Architected review if you have implemented these changes in your workload.
Click here to access the Well-Architected Tool