A SysOps Administrator is tasked with executing a custom configuration script on a new fleet of Amazon EC2 instances using AWS Systems Manager Run Command. The script needs to retrieve files from a private Amazon S3 bucket, and all command execution outputs must be streamed to an Amazon CloudWatch Logs group for auditing.
Arrange the steps in the correct sequence to configure the prerequisites and successfully execute the script.
- 1Create the CloudWatch Logs group and configure an IAM role with the AmazonSSMManagedInstanceCore policy along with permissions for s3:GetObject and CloudWatch logging.
- 2Attach the IAM role as an instance profile to the EC2 instances and verify that the SSM Agent is running on the instances.
- 3Verify that the EC2 instances are registered and appear as managed nodes in the Systems Manager Fleet Manager console.
- 4Execute the Systems Manager Run Command using the AWS-RunShellScript document, specifying the managed nodes as targets and enabling CloudWatch Logs output.
Answer
The correct sequence starts with creating the IAM role and CloudWatch Logs group, followed by attaching the IAM role to the EC2 instances and running the SSM Agent. Next, the administrator verifies that the instances are registered as managed nodes, and finally, executes the Run Command using the custom script and enabling CloudWatch Logs output.
The correct sequence begins with provisioning the necessary IAM policies and the target log group. The IAM role must then be attached to the instances to grant them an identity. Only after the instances are recognized as managed nodes by Systems Manager can the Run Command be executed to run the configuration script and stream the logs.
Step-by-Step Solution
Key Concept
Configuring the necessary IAM instance profile permissions, SSM Agent registration, and executing commands using Systems Manager Run Command with logging.