@@ -170,7 +170,6 @@ export class ImagePipeline extends Construct {
170170 this . imageRecipeComponents = [ ] ;
171171
172172 const uid = Names . uniqueId ( this ) ;
173- const profileName = `${ uid } Profile` ;
174173
175174 // Construct code below
176175 this . builderSnsTopic = new sns . Topic ( this , 'ImageBuilderTopic' , {
@@ -198,12 +197,11 @@ export class ImagePipeline extends Construct {
198197
199198 const profile = new iam . CfnInstanceProfile ( this , 'InstanceProfile' , {
200199 roles : [ role . roleName ] ,
201- instanceProfileName : profileName ,
202200 } ) ;
203201
204202 if ( props . securityGroups == null || props . subnetId == null ) {
205203 infrastructureConfig = new imagebuilder . CfnInfrastructureConfiguration ( this , 'InfrastructureConfiguration' , {
206- instanceProfileName : profileName ,
204+ instanceProfileName : profile . ref ,
207205 name : `${ uid } InfraConfig` ,
208206 description : 'Example Infrastructure Configuration for Image Builder' ,
209207 resourceTags : props . resourceTags ,
@@ -212,7 +210,7 @@ export class ImagePipeline extends Construct {
212210 } ) ;
213211 } else {
214212 infrastructureConfig = new imagebuilder . CfnInfrastructureConfiguration ( this , 'InfrastructureConfiguration' , {
215- instanceProfileName : profileName ,
213+ instanceProfileName : profile . ref ,
216214 name : `${ uid } InfraConfig` ,
217215 description : 'Example Infrastructure Configuration for Image Builder' ,
218216 resourceTags : props . resourceTags ,
0 commit comments