希望通过电子邮件发送云形成输出



我正在编写一个云形成模板,我正在运行两个powershell脚本。现在我想获取这两个脚本的输出,并将其发送到在cloud-formation参数中已经提到的电子邮件。

代码:-

AWSTemplateFormatVersion: '2010-09-09'
Description: Test Document
Resources:  
Type: AWS::SSM::Document
Properties:
DocumentType: Command
Name: "Test Upgrade"
Content: 
schemaVersion: '2.2'
description: "Test Upgrade"
parameters:
Emails:
type: String
description: |- 
enter the email address to send the overall output
mainSteps:
- action: "aws:runPowerShellScript"
name: "DriverUpgrade"
precondition:
StringEquals: ["platformType", "Windows"]
inputs:
runCommand:
[]
timeoutSeconds: 3600
onFailure: Continue
maxAttempts: 1
isCritical: False
nextStep: Second Driver
- action: "aws:runPowerShellScript"
name: "SecondDriverUpgrade"
precondition:
StringEquals: ["platformType", "Windows"]
inputs:
runCommand:
[]
timeoutSeconds: 3600
onFailure: Continue
isCritical: False

您可以在Powershell脚本中或作为Run command参数的一部分使用AWS CLI命令'ses send-email'吗?当然,您必须事先在cfn模板或控制台中配置SES服务。

您可以使用AWS CLI命令ssm get-parameters从参数存储中检索电子邮件地址。

要存储脚本的输出,您可以使用本地文件、参数存储或dynamodb表等。

https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ses/send-email.htmlhttps://awscli.amazonaws.com/v2/documentation/api/latest/reference/ssm/get-parameters.html

最新更新