diff --git a/typescript/imagebuilder/lib/imagebuilder-stack.ts b/typescript/imagebuilder/lib/imagebuilder-stack.ts index c7c7b18f4..5244d7fd8 100644 --- a/typescript/imagebuilder/lib/imagebuilder-stack.ts +++ b/typescript/imagebuilder/lib/imagebuilder-stack.ts @@ -12,9 +12,9 @@ export class ImagebuilderStack extends cdk.Stack { constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { super(scope, id, props); - // Create ImageBuilder componenet that will handle installing git in the base container image + // Create ImageBuilder component that will handle installing git in the base container image const gitComponenet = new imagebuilder.CfnComponent(this, "GitComponenet", { - // Prefix compoenet name with stake name for inter-environment uniqueness + // Prefix component name with stack name for inter-environment uniqueness name: this.stackName + '-' + "Git", platform: "Linux", version: "1.0.0", @@ -23,10 +23,10 @@ export class ImagebuilderStack extends cdk.Stack { 'utf8' ) }); - - // Create ImageBuilder componenet that will handle installing NodeJS in the base container image + + // Create ImageBuilder component that will handle installing NodeJS in the base container image const nodejsComponenet = new imagebuilder.CfnComponent(this, "NodejsComponenet", { - // Prefix compoenet name with stake name for inter-environment uniqueness + // Prefix component name with stack name for inter-environment uniqueness name: this.stackName + '-' + "Nodejs", platform: "Linux", version: "1.0.0", @@ -35,10 +35,10 @@ export class ImagebuilderStack extends cdk.Stack { 'utf8' ) }); - - // Create ImageBuilder componenet that will handle installing Docker in the base container image + + // Create ImageBuilder component that will handle installing Docker in the base container image const dockerComponenet = new imagebuilder.CfnComponent(this, "DockerComponenet", { - // Prefix compoenet name with stake name for inter-environment uniqueness + // Prefix component name with stack name for inter-environment uniqueness name: this.stackName + '-' + "Docker", platform: "Linux", version: "1.0.2", @@ -47,11 +47,11 @@ export class ImagebuilderStack extends cdk.Stack { 'utf8' ) }); - + // Create the Amazon Elastic Container Registry repository that will host the resulting image(s) const ecrRepoForImageBuilderCodeCatalyst = new ecr.Repository(this, "EcrRepoForImageBuilderCodeCatalyst") - - // Create an ImageBuilder recipe that contains the 3 compoenets + + // Create an ImageBuilder recipe that contains the 3 components const AmazonLinux2023wGitNodeRecipe = new imagebuilder.CfnContainerRecipe(this, "AmazonLinux2023withGitAndNodeRecipe", { components: [ { @@ -66,7 +66,7 @@ export class ImagebuilderStack extends cdk.Stack { ], containerType: "DOCKER", dockerfileTemplateData: "FROM {{{ imagebuilder:parentImage }}}\n{{{ imagebuilder:environments }}}\n{{{ imagebuilder:components }}}\n", - // Prefix recipe name with stake name for inter-environment uniqueness + // Prefix recipe name with stack name for inter-environment uniqueness name: this.stackName + '-' + "AmazonLinux2023WithGit", // Use amazon linux 2023 base image with the latest version tag indicated by /x.x.x parentImage: `arn:aws:imagebuilder:${this.region}:aws:image/amazon-linux-2023-x86-latest/x.x.x`, @@ -77,7 +77,7 @@ export class ImagebuilderStack extends cdk.Stack { }, version: "2.1.2" }) - + // Create an IAM role for ImageBuilder EC2 build instances, that has the needed AWS Managed policies const iamRoleForImageBuilder = new iam.Role(this, 'EC2InstanceProfileForImageBuilder', { assumedBy: new iam.ServicePrincipal('ec2.amazonaws.com'), @@ -102,20 +102,20 @@ export class ImagebuilderStack extends cdk.Stack { const instanceProfileForImageBuilder = new iam.InstanceProfile(this, "InstanceProfileForImageBuilder", { role: iamRoleForImageBuilder }); - + // Create build infrastructure configuration that uses the instance profile const infraConfig = new imagebuilder.CfnInfrastructureConfiguration(this, "ImageBuilderInfraConfig", { - // Prefix recipe name with stake name for inter-environment uniqueness + // Prefix recipe name with stack name for inter-environment uniqueness name: this.stackName + '-' + "infra", instanceProfileName: instanceProfileForImageBuilder.instanceProfileName, }); - + // Create a distribution config to specify where the resulting image(s) should be stored const distConfig = new imagebuilder.CfnDistributionConfiguration(this, "ImageBuilderDistConfig", { - // Prefix recipe name with stake name for inter-environment uniqueness + // Prefix recipe name with stack name for inter-environment uniqueness name: this.stackName + '-' + "dist", distributions: [ - { + { // Set the target region to the same region where the current stack is deployed region: this.region!, containerDistributionConfiguration: { @@ -128,10 +128,10 @@ export class ImagebuilderStack extends cdk.Stack { } ] }); - + // Create the ImageBuilder pipeline using the infrastructure, distribution, and container recipe above const imageBuilderPipeline = new imagebuilder.CfnImagePipeline(this, "AmazonLinux2023WithGitPipeline", { - // Prefix recipe name with stake name for inter-environment uniqueness + // Prefix recipe name with stack name for inter-environment uniqueness name: this.stackName + '-' + "AmazonLinux23WithGitPipeline", infrastructureConfigurationArn: infraConfig.attrArn, distributionConfigurationArn: distConfig.attrArn,