1
votes

I am writing a cloud formation template that I want to be run by multiple teams. I want to know which team is starting the stack using my template without making it a parameter.

Although I eventually want to use value in a map a simpler example as an Output will be easier to explain.

"Outputs":{
   "UserId" : {
    "Description" : "Group of user who called the stack",
    "OutputKey" : "GroupARN",
    "OutputValue" : { 
       "Fn::GetAtt" : [ "*** Resource of calling user ***", "AWS::IAM::Group"]
    }
  }
}

What I can't find is what resource I should use.

The guide for resources only talks about resources created in the template and that may mean I can't get the stack caller from a resource. If that is true is there another way or will I have to fall back to putting it as a parameter on the cloud formation template.

Ref:

1

1 Answers

2
votes

Have you tried pseudo parameters? You can do something like:

...
"OutputValue" : {
    {"Ref": "AWS::AccountId"}
}

AWS::AccountId

Returns the AWS account ID of the account in which the stack is being created, such as 123456789012.