amazon web services - Cloudformation to automatically pick up the default instance profile -


i use cloudformation template deploy instance environment. want template pick default ec2 instance profile instance "arn:aws:iam::12345678910:role/ec2instanceprofile-instancerole-14f2a0atjnuo1"

i use same template every aws accounts have. however, problem instance profile name different in every account. randomly generated suffix attached name (in example 14f2a0atjnuo1). how can workaround problem make template reusable in every account. please provide code if possible.

    "ec2instanceprofile" : {       "description" : "the default instance profile",       "type": "string",       "constraintdescription" : "must name of existing defualt ec2 instance profile."     },  "iaminstanceprofile": { "ref": "ec2instanceprofile" } 

get instance profile role name using below cloudformation.

"instanceprofile" : {   "type" : "aws::iam::instanceprofile",   "properties" : {     "path" : "/",     "roles" : ["your-role-name"]   } } "iaminstanceprofile": {"fn::getatt" : ["instanceprofile", "arn"] }, 

Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -