1
0
mirror of synced 2024-11-24 13:56:08 +03:00

- update comments in lambda function code

- add traceback for the second lambda function code for easy diagnosis
- minor formattings
This commit is contained in:
Scottpedia 2023-09-23 13:40:16 -04:00
parent 46cebd031e
commit 437b681725

View File

@ -408,6 +408,8 @@
"'''", "'''",
"This python program should be embedded into its designated cloudformation", "This python program should be embedded into its designated cloudformation",
"template as the inline code of one of the lambda functions.", "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):", "def handler(event, context):",
" try:", " try:",
@ -424,7 +426,7 @@
[ [
" Name='/ec2/keypair/", " Name='/ec2/keypair/",
{ {
"Fn::GetAtt":[ "Fn::GetAtt": [
"KeyPair", "KeyPair",
"KeyPairId" "KeyPairId"
] ]
@ -509,6 +511,7 @@
[ [
"import boto3", "import boto3",
"import cfnresponse", "import cfnresponse",
"import traceback",
"'''", "'''",
"This python script should be embeded into its designated cloudformation template.", "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.", "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']", " AMIId = images[0]['ImageId']",
" cfnresponse.send(event, context, cfnresponse.SUCCESS, {'AMIId':AMIId}, 'AMIInfo')", " cfnresponse.send(event, context, cfnresponse.SUCCESS, {'AMIId':AMIId}, 'AMIInfo')",
" except Exception:", " except Exception:",
" cfnresponse.send(event, context, cfnresponse.FAILED, {})" " cfnresponse.send(event, context, cfnresponse.FAILED, {'ErrorMsg':traceback.format_exc()})"
] ]
] ]
} }