From 437b681725dd0b28d6fa49e614700f306f86b5ea Mon Sep 17 00:00:00 2001 From: Scottpedia Date: Sat, 23 Sep 2023 13:40:16 -0400 Subject: [PATCH] - update comments in lambda function code - add traceback for the second lambda function code for easy diagnosis - minor formattings --- aws/cloudformation-template-ipsec.json | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/aws/cloudformation-template-ipsec.json b/aws/cloudformation-template-ipsec.json index 0db35a7..4e2af31 100644 --- a/aws/cloudformation-template-ipsec.json +++ b/aws/cloudformation-template-ipsec.json @@ -408,6 +408,8 @@ "'''", "This python program should be embedded into its designated cloudformation", "template as the inline code of one of the lambda functions.", + "Its function is to create a random combination of 20 characters for the naming of the Ikev2S3Bucket, and", + "to retrieve the private key material for display under the Outputs tab.", "'''", "def handler(event, context):", " try:", @@ -422,9 +424,9 @@ "Fn::Join": [ "", [ - " Name='/ec2/keypair/", + " Name='/ec2/keypair/", { - "Fn::GetAtt":[ + "Fn::GetAtt": [ "KeyPair", "KeyPairId" ] @@ -509,6 +511,7 @@ [ "import boto3", "import cfnresponse", + "import traceback", "'''", "This python script should be embeded into its designated cloudformation template.", "Its function is to sort out the correct AMI image to use for each of the distribution options available.", @@ -536,7 +539,7 @@ " AMIId = images[0]['ImageId']", " cfnresponse.send(event, context, cfnresponse.SUCCESS, {'AMIId':AMIId}, 'AMIInfo')", " except Exception:", - " cfnresponse.send(event, context, cfnresponse.FAILED, {})" + " cfnresponse.send(event, context, cfnresponse.FAILED, {'ErrorMsg':traceback.format_exc()})" ] ] }