Changing LocalStack Account ID to a Custom Value (not defualt 000000000000)

39 Views Asked by At

I'm currently working with localstack on creating some integration tests.

I'd like to configure the account ID to something other then the default 000000000000

I found this closed bug which implies that one can set the account id via the environemnt variable TEST_AWS_ACCOUNT_ID. At least that's how I understand it.

Unfortunately when I set this, and then run the following code in a test

val stsClient: AWSSecurityTokenService =
  AWSSecurityTokenServiceClientBuilder.standard()
    .withCredentials(credentialsProviders.v1)
    .withEndpointConfiguration(new EndpointConfiguration(localStack.endpointOverride(LocalStackContainer.Service.STS).toString, v1Region.value.getName))
    .build()

val thisAccountId = AccountId(stsClient.getCallerIdentity(new GetCallerIdentityRequest()).getAccount)
println(s"ThisAccountID: $thisAccountId")

I get the following printout ThisAccountID: 000000000000

I'd greatly appreciate any insights into whether it's possible to change the account ID and, if so, how to achieve this. Thank you for your help

0

There are 0 best solutions below