I’ll address all three focus areas systematically:
Greengrass IAM Execution Role: Your token exchange role needs multiple permissions beyond basic S3 access. Update the IAM policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::ml-models-prod",
"arn:aws:s3:::ml-models-prod/*"
]
},
{
"Effect": "Allow",
"Action": [
"kms:Decrypt",
"kms:DescribeKey"
],
"Resource": "arn:aws:kms:region:account:key/your-key-id"
}
]
}
The ListBucket permission on the bucket itself (not just objects) is critical for Greengrass to verify artifact existence.
S3 Bucket/Object Permissions: The issue is likely a combination of IAM and KMS key policies. Your KMS key policy must explicitly allow the token exchange role:
{
"Sid": "Allow Greengrass to decrypt model artifacts",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::account:role/GGv2TokenExchangeRole"
},
"Action": [
"kms:Decrypt",
"kms:DescribeKey"
],
"Resource": "*"
}
Additionally, if your S3 bucket has a bucket policy, ensure it doesn’t deny access to the Greengrass service or your role. Remove any explicit deny statements that might override the IAM permissions.
Policy Simulator Usage: The policy simulator has limitations with Greengrass because it doesn’t fully simulate the STS session policies applied during role assumption. Instead, test permissions using AWS CLI with the --debug flag:
# Pseudocode - Testing permission chain:
# 1. Assume the token exchange role using STS
# 2. Use temporary credentials to attempt S3 GetObject
# 3. Verify KMS decrypt operation succeeds
# 4. Check CloudTrail logs for denied API calls
# 5. Review Greengrass component logs for detailed error context
CloudTrail is your best tool here - it will show the exact principal and policy that denied the request.
One final check: ensure your Greengrass core device’s system time is synchronized. Certificate-based authentication can fail if there’s significant clock drift, causing access denied errors that appear to be permission-related.
After implementing these IAM policy updates and KMS key policy changes, restart your Greengrass core device to force re-authentication with the updated permissions. The component should then successfully download and load the ML model from S3.