Invoking the Lambda function via AWS Console or AWS CLI to create a request to the SES to send an e-mail using the configured e-mail identity on AWS SES. The e-mail identity set must be verified beforehand, and remember that the e-mail address is case-sensitive. The Lambda function must have permission or is authorized to perform ses:SendEmail
on the SES resource identity.
Check the inbox of the e-mail address used to create your identity and click the link to complete the verification process for the e-mail address.
- Go to Lambda → Lambda Function → Test tab
- Update the Event JSON textarea field (see sample payload)
- Click on the Test button in the upper right corner
- Use the following command and replace the placeholder
lambda_function_name
with the actual Lambda function nameaws lambda invoke \ --function-name lambda_function_name \ --payload '{"subject": "COD #210327LL6J2NE7", "recipients": [ "[email protected]" ], "body": "Hello John Doe,\nYour Cash On Delivery (COD) payment request for order #210327LL6J2NE7 has been approved. We have notified the seller to start shipping your item(s).\n\n\tORDER DETAILS\n\t\tOrder ID: #210327LL6J2NE7\n\t\tOrder Date: 03/27/21 01:16:27\n\t\tSeller: ABC Company Inc.\n\nKindly wait for your shipment and have cash ready to pay for your products upon delivery. Once you receive and accept the product(s), kindly confirm this with us in ABC App."}' \ --cli-binary-format raw-in-base64-out \ response.json
{
"subject": "COD #210327LL6J2NE7",
"recipients": [ "[email protected]" ],
"body": "Hello John Doe,\nYour Cash On Delivery (COD) payment request for order #210327LL6J2NE7 has been approved. We have notified the seller to start shipping your item(s).\n\n\tORDER DETAILS\n\t\tOrder ID: #210327LL6J2NE7\n\t\tOrder Date: 03/27/21 01:16:27\n\t\tSeller: ABC Company Inc.\n\nKindly wait for your shipment and have cash ready to pay for your products upon delivery. Once you receive and accept the product(s), kindly confirm this with us in ABC App."
}
- Send an Email with Amazon SES
- Verified identities in Amazon SES
- Moving out of the Amazon SES sandbox
The cdk.json
file tells the CDK Toolkit how to execute your app.
npm install
install projects dependenciesnpm run build
compile typescript to jsnpm run watch
watch for changes and compilenpm run test
perform the jest unit testscdk deploy
deploy this stack to your default AWS account/regioncdk diff
compare deployed stack with current statecdk synth
emits the synthesized CloudFormation templatecdk bootstrap
deployment of AWS CloudFormation template to a specific AWS environment (account and region)cdk destroy
destroy this stack from your default AWS account/region
-
Install all the dependencies, bootstrap your project, and synthesized CloudFormation template.
# Without passing "profile" parameter dev@dev:~:aws-cdk-samples/ses/ses-send-email$ make init # With "profile" parameter dev@dev:~:aws-cdk-samples/ses/ses-send-email$ make init profile=[profile_name]
-
Deploy the project.
# Without passing "profile" parameter dev@dev:~:aws-cdk-samples/ses/ses-send-email$ make deploy # With "profile" parameter dev@dev:~:aws-cdk-samples/ses/ses-send-email$ make deploy profile=[profile_name]