在 AWS Cloudformation 中,我可以cloudformation package
通过 CLI 使用该命令。例如,这适用于 Lambda:
lambda:
Type: AWS::Lambda::Function
Properties:
Handler: helloWorld.lambda_handler
Role: !GetAtt lambda.Arn
Code: lambda/helloWorld.py
现在,我想Code: lambda/helloWorld.py
在 Systems Manager 中像自动化文档一样。
例如,我想使用下面这样的外部脚本,而不是下面的行(Restart-Computer -Force
):commands:
commands: scripts/restart.ps1
#---Original
[...]
- name: restartEC2Instance
action: aws:runCommand
maxAttempts: 3
timeoutSeconds: 600
inputs:
DocumentName: AWS-RunPowerShellScript
InstanceIds:
- "{{ InstanceId }}"
Parameters:
commands: |
Restart-Computer -Force
executionTimeout: "600"
[...]
#---Desired
[...]
- name: restartEC2Instance
action: aws:runCommand
maxAttempts: 3
timeoutSeconds: 600
inputs:
DocumentName: AWS-RunPowerShellScript
InstanceIds:
- "{{ InstanceId }}"
Parameters:
commands: scripts/restart.ps1
executionTimeout: "600"
[...]
您知道实现这一点的任何可能性吗?提前致谢!