On the right menu, locate and click on Policies
Then click on Create Policy
On the Specify Permissions window, choose JSON for our policy editor.
You can also use the Visual Editor to specify permission but it is usually prone to mistakes, so review carefully before creating policy.
Copy the JSON policy below to the clipboard.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"logs:CreateLogStream",
"logs:CreateLogGroup",
"logs:PutLogEvents"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::YOUR-BUCKET-NAME",
"arn:aws:s3:::YOUR-BUCKET-NAME/*"
]
}
]
}
Replace YOUR-BUCKET-NAME with the actual name of your bucket that you’ve copied before.
Click on Next
Enter the policy name as LambdaWatermarkS3
Review the policy permission and click on Create policy
In the policy list, filter by name LambdaWatermarkS3
or by type Customer managed, you should find the new policy has been created
Next, let’s create an IAM Role and attach this policy.