Pass Params in ImageBuilder Component ExecutePowerShell Action

0

I am referring to the link aws-resource-imagebuilder-component--examples

I am trying to create a Component for ImageBuilder for executing a PowerShell script. However, I am not sure how to pass parameters or arguments to this. Please help with examples / steps.

Although, I saw this link image-builder-supports-parameters-components-creating-custom-images, there are no details.

已提问 10 个月前278 查看次数
1 回答
0

Hello,

Using Resource type "AWS::ImageBuilder::Component" you can create a new component that can be used to build, validate, test, and assess your image. The component is based on a YAML document that you can specify either inline using "Data" property or specify a URL that points to a YAML document file stored in Amazon S3, using the "Uri" property. Within the YAML document, you can specify your component parameters. Please refer the following document for more details on the YAML document of the ImageBuilder Component: https://docs.aws.amazon.com/imagebuilder/latest/userguide/manage-component-parameters.html

Within the YAML document, in the ExecutePowerShell action module you can specify either "commands" or "file" to execute a list of inline PowerShell commands or PowerShell script.

Now, once you have defined the ImageBuilder component with parameters, you can pass the parameters along with their value when creating the ImageRecipe resource using ComponentArn and Parameters property of Components. Please refer the examples of ImageRecipe resource in the following document:

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-imagebuilder-imagerecipe.html#aws-resource-imagebuilder-imagerecipe--examples

AWS
支持工程师
Sonal_A
已回答 10 个月前
  • Thank you. I found the above documentation links just a while ago and was about to edit / remove my question. Anyways, I have a few more questions regarding Image Builder. Please help with those also.

    1. In AWS::ImageBuilder::Recipe, there is a ParentImage property (as per documentation), taking either an Image ARN or an AMI ID. How can I get the ARN of My AMI, if I have built a custom one. Else, can I use a wildcard card AMI name?
    2. How to pass sensitive information like passwords, keys etc as component parameters so that they don't get output anywhere (including CloudWatch or S3 logs)?
    3. Also, how to pass parameters to a script file? Is the below syntax valid?
    • name: ExecuteScript action: ExecutePowerShell onFailure: Abort maxAttempts: 3 inputs: commands: - cd c:\temp - .\run_myscript.ps1 -param1 {{ param1}} -password {{ password }}
    1. Component Parameters support only string type and not others like number, boolean etc?

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则

相关内容