How to pass parameters to PowerShell Script File in EC2 Image Builder Component?

0

I am referring to the below link to pass parameters to a component. However I am not sure how to pass parameters to a PowerShell script file. https://docs.aws.amazon.com/imagebuilder/latest/userguide/manage-component-parameters.html

Basically, I want to know 3 things.

  1. How to pass parameters as key value pairs to a PowerShell script file? I tried the following in YAML.
  • my_scripts.ps1 -param1 {{param1Value}} -param2 {{param2Value}}. But this didn't work.
  1. How to pass sensitive parameters like password so that it is masked everywhere, including CloudWatch, Component screen and S3 bucket etc?
  2. Apart from String type, what other types are supported for Parameters?
질문됨 10달 전691회 조회
1개 답변
0
수락된 답변
  1. Here’s an example of how you would specify parameters in the component, as structured in the documentation:
schemaVersion: 1.0
description: Example EC2 Image Builder Component
parameters:
  - Param1Value:
      type: string
      description: Param 1 Value
      default: value-1
  - Param2Value:
      type: string
      description: Param 2 Value
      default: value-2
phases:
  - name: build
    steps:
      - name: RunPowerShellScript
        action: ExecutePowerShell
        inputs:
          commands:
            - .\sample.ps1 -param1 {{Param1Value}} -param2 {{Param2Value}}
  1. How to pass sensitive parameters like password so that it is masked everywhere, including CloudWatch, Component screen and S3 bucket etc?
We do not recommend passing sensitive strings in component parameters, since they are stored in plaintext. Instead, you can do something like store the secrets in Secrets Manager and retrive them in your component's scripts, which can be done via AWS CLI in the component.
  1. Apart from String type, what other types are supported for Parameters?
Currently, string types are supported in Image Builder.
답변함 9달 전
  • Thank you. I figured these out a couple of days ago. Also, for sensitive values, I am retrieving them from Secret Manager.

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

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

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