Since you are already at the IAM dashboard for the last step, now headed to the policies and create one for the execution role
Create a policy for the execution role
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "EC2Snapshot",
"Effect": "Allow",
"Action": [
"ec2:AuthorizeSecurityGroupIngress",
"ec2:Describe*",
"logs:CreateLogStream",
"ec2:CreateSecurityGroup",
"ec2:CreateTags",
"ec2:CreateSnapshots",
"ec2:CreateSnapshot",
"ec2:ModifyInstanceAttribute",
"ec2:StopInstances",
"logs:CreateLogGroup",
"logs:PutLogEvents"
],
"Resource": "*"
}
]
}
ec2instance-containment-with-forensics-policy
and leave the rest unchanged, then Create policy.Create the execution role for the Lambda Function
ec2instance-containment-with-forensics-policy
policy and click next.ec2instance-containment-with-forensics-role
and leave every unchanged, click Create Role.If you done with that go to the next step which is Create Lambda Function