Project

General

Profile

Support #49549

createRole failed

Added by lee jia about 3 years ago. Updated almost 3 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Target version:
% Done:

0%

Tags:
Reviewed:
Affected Versions:
Pull request ID:

Description

I want to create Role via Java code,but I got Service: AmazonIdentityManagement; Status Code: 400; Error Code: 400 Bad Request;
Here is my code:

AmazonIdentityManagement amazonIdentityManagementClient = AmazonIdentityManagementClientBuilder.standard().withCredentials(new AWSStaticCredentialsProvider(credentials)).withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration("http://10.0.5.30", "xian")).build();
CreateRoleRequest createRoleRequest = new CreateRoleRequest();
String documentPolicy = "\\{\\\"Version\\\":\\\"2012-10-17\\\",\\\"Statement\\\":\\[\\{\\\"Effect\\\":\\\"Allow\\\",\\\"Principal\\\":\\{\\\"AWS\\\":\\[\\\"arn:aws:iam:::user/rr\\\"\\]\\},\\\"Action\\\":\\[\\\"sts:AssumeRole\\\"\\]\\}\\]\\}";
createRoleRequest.setAssumeRolePolicyDocument(documentPolicy);
createRoleRequest.setPath("/");
createRoleRequest.setRoleName("S3Access1");
CreateRoleResult role = amazonIdentityManagementClient.createRole(createRoleRequest);
System.out.println(role.getRole().getArn());

The user 'rr' is valid user.

Here is the ceph log:

2021-03-01T09:49:38.848329932Z debug 2021-03-01T09:49:38.844+0000 7feb35e9a700 1 ====== starting new request req=0x7febb30af6b0 =====
2021-03-01T09:49:39.323970918Z debug 2021-03-01T09:49:39.316+0000 7feb32693700 1 ====== req done req=0x7febb30af6b0 op status=-2204 http_status=400 latency=0.471993569s ======
2021-03-01T09:49:39.324030650Z debug 2021-03-01T09:49:39.316+0000 7feb32693700 1 beast: 0x7febb30af6b0: 10.0.5.31 - - [2021-03-01T09:49:39.316314+0000] "POST / HTTP/1.1" 400 190 - "aws-sdk-java/1.11.853 Mac_OS_X/10.16 Java_HotSpot(TM)_64-Bit_Server_VM/25.202-b08 java/1.8.0_202 kotlin/1.4.20 vendor/Oracle_Corporation" -

History

#1 Updated by lee jia about 3 years ago

Some Configuration error, Sorry~ Please close this issue

#2 Updated by Greg Farnum almost 3 years ago

  • Tracker changed from Bug to Support
  • Project changed from Ceph to rgw
  • Category deleted (java)
  • Status changed from New to Resolved

Also available in: Atom PDF