I'm trying without success to create a role with a specific permission:
This is my permission:
String jsonRole = "{" +
" \"Version\": \"2012-10-17\"," +
" \"Statement\": [" +
" {" +
" \"Effect\": \"Allow\"," +
" \"Action\": [" +
" \"s3:PutObject\"," +
" \"s3:GetObject\"," +
" \"s3:GetObjectVersion\"," +
" \"s3:DeleteObject\"," +
" \"s3:DeleteObjectVersion\"" +
" ]," +
" \"Resource\": \"arn:aws:s3:::"+artifactsBucket+"/"+company.getCompanyId()+"/*\"" +
" }" +
" ]" +
"}";
and the command to create the role:
AmazonIdentityManagement client = AmazonIdentityManagementClientBuilder.standard().build();
CreateRoleRequest request = new CreateRoleRequest().withPath("/companies-bucket-roles/").withRoleName(company.getName()+"-"+consoleUser.getConsoleUserId());
But I don't know how to add the permission to the role. I found nothing in the documentation. Any idea ?
Thanks in advance