hsnclk
hsnclk

Reputation: 77

Creating Account in the AWS Organizations using AWS SDK for Java

Can you give a sample about this question? I've tried something about it but not have succeeded yet. How can I create an account for someone else on my master account?

    @Bean
        public AWSOrganizations createAwsAccount(){
            CreateAccountRequest createAccountRequest = new CreateAccountRequest();
            createAccountRequest.setAccountName("newAccount");
            createAccountRequest.setEmail("[email protected]");
            createAccountRequest.setIamUserAccessToBilling("ALLOW");
            //createAccountRequest.setRoleName("");
            AWSCredentials awsCredentials = new ProfileCredentialsProvider().getCredentials();
            final AWSOrganizations awsOrganizations = AWSOrganizationsClientBuilder.standard().withCredentials(new AWSStaticCredentialsProvider(awsCredentials)).build();
            awsOrganizations.createAccount(createAccountRequest);
            return awsOrganizations;
        }

I know, the code I wrote does not make any sense but I just wanted to try something. I'm waiting for your help about this subject.

ErrorMessage: You cannot add accounts to your organization while it is initializing. Try again later.

Upvotes: 0

Views: 1832

Answers (1)

Diego Jancic
Diego Jancic

Reputation: 7440

You probably resolved this already, but just in case anyone else finds this:

It seems to be an issue with AWS that is taking them forever to fix!

Look at this thread in the AWS forums. It was opened on March and some (including me) are still having issues. The API call is correct, you just have to either continue waiting (days? weeks?), contact support, or put a message on that topic.

Upvotes: 1

Related Questions