- Newest
- Most votes
- Most comments
Have you tried using Visual editor to help you with this? It guides you with policy creation.
The policy you've provided allows all actions you listed on all resources (*) with an "Allow" effect. This is likely too permissive and could pose a security risk. You should specify the specific resources and actions that are needed for your use case. For instance, you can specify a specific Amazon Resource Name (ARN) for the resource. You should also consider adding a condition to the policy. This will allow you to further restrict access to the resources and actions. For example, you can restrict access to a specific IP address, user, or time of day.
Here is an example policy that is more restrictive:
{
"Version":"2012-10-17",
"Statement":[
{
"Effect":"Allow",
"Action":[
"iam:CreateRole",
"iam:PutRolePolicy",
"lambda:CreateFunction",
"lambda:InvokeAsync",
"lambda:InvokeFunction",
"iam:PassRole"
],
"Resource":[
"arn:aws:iam::123456789012:role/lambda-execution-role"
],
"Condition":{
"IpAddress":{
"aws:SourceIp":"192.0.2.0/24"
}
}
}
]
}
The above example policy is just an example, you should use values that match your use case.
Relevant content
- asked a year ago

Thank you very much for your help, I already figured it out and found this policy in the AWS documentation