A SysOps Administrator is running a compliance verification script across a fleet of Amazon EC2 instances in a private subnet using AWS Systems Manager Run Command with the AWS-RunShellScript document. The instances have the SSM Agent installed and running, and they are associated with an IAM instance profile containing the AmazonSSMManagedInstanceCore managed policy. To capture the full script output, the administrator specifies a custom Amazon S3 bucket in the Run Command parameters. The execution completes, but the command status shows as 'Failed' on all instances, and no logs are delivered to the S3 bucket. What should the administrator do to resolve this issue?
- Attach an IAM policy to the EC2 instances' IAM role that grants the s3:PutObject permission for the target S3 bucket.Cevap
- BAssociate a custom IAM service role with the Systems Manager service that has write access to the S3 bucket, and grant the administrator the iam:PassRole permission for this role.
- CAssociate the instances with a Systems Manager Patch Group whose name matches the target S3 bucket path.
- DConfigure a Gateway VPC Endpoint for Amazon S3 and associate it with the route tables of the EC2 instances' subnets.
Cevap
Attach an IAM policy to the EC2 instances' IAM role that grants the s3:PutObject permission for the target S3 bucket.
When configuring AWS Systems Manager Run Command to upload output logs to an Amazon S3 bucket, the SSM Agent running locally on each EC2 instance performs the upload. The agent executes within the security context of the instance's IAM instance profile. Since the default AmazonSSMManagedInstanceCore managed policy does not grant permissions to write to arbitrary S3 buckets, you must explicitly attach a policy to the instance profile role that allows the s3:PutObject action on the target S3 bucket.
Adım Adım Çözüm
Anahtar Kavram
EC2 Instance Profile permissions for SSM Run Command S3 log redirection
Tahmini Süre:2m 0s