Question on AWS SSM automation

0

I created a common administrative task via run command with AWS-RunPowerShellScript targeting a few Windows instances. I tested it and it works. I'd like to automate it so that whenever I or someone needs to run we can just kick off. It'd be great if I was able to call it from Jenkins build (Jenkinsfile). I thought to use the CLI command ("aws ssm send-command") as is in Jenkinsfile, but SSM does not support Power Shell or Windows command platforms. It only supports Linux/Unix/OS X platform.

Sri
질문됨 5달 전422회 조회
1개 답변
0

Here are a few options to automate and execute your PowerShell script on Windows EC2 instances from Jenkins:

  1. Use Jenkins Powershell plugin to directly run the PowerShell script on the instances as part of your Jenkins job. You can specify the script path and target machines.

  2. Install AWS CLI on your Jenkins server and use aws ssm send-command to invoke the script. Even though SSM doesn't directly support PowerShell, you can invoke cmd.exe to then execute the PowerShell script.

  3. Use Jenkins to copy the PowerShell script to a shared location on the instances (e.g. S3) and then use aws ssm send-command to execute a cmd.exe script to download and invoke it.

  4. Switch to using AWS RunCommand which is the successor to SSM documents for automating ops. It has better support for PowerShell scripts on Windows. Invoke the run command from Jenkins.

  5. Use Jenkins Powershell plugin to copy the script to instances first, then use aws ssm send-command to invoke cmd.exe to execute the script locally.

  6. Package the PowerShell script into an SSM document for Windows. This can then be executed directly using aws ssm send-command even if SSM doesn't natively support PS.

So in summary, combine Jenkins with AWS CLI and PowerShell plugins, SSM, RunCommand or cmd.exe invocation to automate running your Powershell administrative tasks on Windows from Jenkins.

AWS
Saad
답변함 5달 전
  • SSM doesn't support powershell or windows command cli

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

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

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

관련 콘텐츠