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달 전279회 조회
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?

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠