Hello,
Using Java CDK, I'm trying to create an execution role having attached the "AmazonS3FullAccess" managed policy. The following statement:
Role role = Role.Builder.create(this, "...").roleName("...")
.assumedBy(ServicePrincipal.Builder.create("lambda.amazonaws.com").build())
.managedPolicies(List.of(ManagedPolicy.fromAwsManagedPolicyName("AmazonS3FullAccess "))).build();
raises the exception below:
12:16:35 PM | CREATE_FAILED | AWS::IAM::Role | quarkusapigatewaylambdarole76F80EE0
Resource handler returned message: "ARN arn:aws:iam::aws:policy/service-role/AmazonS3FullAccess is not valid. (Service: Iam, Status Code: 400, Request ID: f4c56992-942c-48cb-825c-c2a139514373)" (RequestToken: d7ff2022-a057-486e-8d94-8
74b67d0e753, HandlerErrorCode: InvalidRequest)
I've tried also to use "service-role/AmazonS3FullAccess" as the managed policy name but with the same result.
However, looking in the AWS Console, at IAM->Polices I can see that the mentioned policy exists. So, what might be the problem here ?
Many thanks in advance for your help.
Kind regards,
Nicolas
Hi, this was it, many thanks. So for the records, the right statement is:
and not
as I've seen in different places.
Hi, glad that you fixed your issues! Thanks for accepting my answer. Didier