Skip to content

Commit 734cc78

Browse files
Updated policy principal
1 parent bb1477d commit 734cc78

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

boto3_sample/s3_event_notifications_crawler_setup.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def set_sns_topic_policy(topic_arn, client, bucket_name):
124124
"Id": "s3-publish-to-sns",
125125
"Statement": [{
126126
"Effect": "Allow",
127-
"Principal": { "AWS" : "*" },
127+
"Principal": { "AWS": "%s" },
128128
"Action": [ "SNS:Publish" ],
129129
"Resource": "%s",
130130
"Condition": {
@@ -136,7 +136,7 @@ def set_sns_topic_policy(topic_arn, client, bucket_name):
136136
}
137137
}
138138
}]
139-
}''' % (topic_arn, account_id, bucket_name)
139+
}''' % (topic_arn, account_id,account_id,bucket_name)
140140
)
141141
return True
142142
except botocore.exceptions.ClientError as e:
@@ -194,7 +194,7 @@ def set_sqs_policy(queue_url, queue_arn, client, topic_arn):
194194
{
195195
"Sid": "AllowSNSPublish01",
196196
"Effect": "Allow",
197-
"Principal": "*",
197+
"Principal": { "AWS": "%s" },
198198
"Action": "SQS:SendMessage",
199199
"Resource": "%s",
200200
"Condition": {
@@ -204,7 +204,7 @@ def set_sqs_policy(queue_url, queue_arn, client, topic_arn):
204204
}
205205
}
206206
]
207-
}''' % (queue_arn, topic_arn)
207+
}''' % (account_id,queue_arn, topic_arn)
208208
}
209209
)
210210
return True

0 commit comments

Comments
 (0)