How can I retrieve AWS Account Name from within a CloudFormation template?

Viewed 1820
1 Answers

Not sure what do you mean by "account name". In AWS you only have the following two AWS account identifiers:

  • AWS account ID
  • Canonical user ID

My guess is that you are referring to account alias. If so, there is no direct way of getting it from CFN. But you can design your own custom resource in CFN. The resource would be in the form of a lambda function which would use AWS API ListAccountAliases to list the account aliases and return them to your template for further use.

Related