Error when uploading template file in Service Catalog

0

Hey guys,

I wanted to create a new product in the service catalog. I followed this article to automate the account creation: https://aws.amazon.com/de/blogs/mt/automate-account-creation-and-resource-provisioning-using-aws-service-catalog-aws-organizations-and-aws-lambda/

Because we dont need the resources getting deployed with the configuration files from this article, I deleted them in Accountbaseline.yml and accountbuilder.yml and also removed the functions for their deployment in AccountCreationLambda.py . The AccountBuilderLambda and the LambdaExecuteRole event are executing successfully but the TriggerLambda event is in status "Create in progress" for an hour, then I get the error message: The following resource(s) failed to create: [TriggerLambda]. Rollback requested by user.}, {LogicalResourceId : TriggerLambda, ResourceType : Custom::TriggerLambda, StatusReason : CloudFormation did not receive a response from your Custom Resource. Please check your logs for requestId [7dd4b91c-8ef2-4405-9e1c-6b45118b931a]. If you are using the Python cfn-response module, you may need to update your Lambda function code so that CloudFormation can attach the updated version.}, {LogicalResourceId : AccountBuilderLambda, ResourceType : AWS::Lambda::Function, StatusReason : Resource creation Initiated}, {LogicalResourceId : LambdaExecuteRole, ResourceType : AWS::IAM::Role, StatusReason : Resource creation Initiated}, {LogicalResourceId : SC-761183374848-pp-laowqzpxqaghw, ResourceType : AWS::CloudFormation::Stack, StatusReason : User Initiated}]

The only error I can find in the CloudWatch logs for the Lambda function is: [ERROR] Runtime.HandlerNotFound: Handler 'main' missing on module 'AccountCreationLambda'

I put the three files on GitHub: https://github.com/MarkWie/aws_template/blob/fecb660c79d41988018ffc96f202c88a69ef6c78/AccountCreationLambda.py The parts with the ''' ''' were commented out by me aswell as single lines with ##

Can anyone help with this issue?

Best regards Mark

  • Would it be possible for you to add the template body here, which you have after removing the portion that you didn't need?

  • Hey Abhishek_At_AWS,

    I put it on GitHub: https://github.com/MarkWie/aws_template/blob/fecb660c79d41988018ffc96f202c88a69ef6c78/AccountCreationLambda.py The parts with the ''' ''' were commented out by me aswell as single lines with ##

  • Thanks for sharing the modified lambda code but I need to see other two yml files as well to see what's missing. Could you please upload those two files too at same location.

  • For sure. I've uploaded them.

  • Hey Abhishek_At_AWS,

    Update from my side: I've uploaded the wrong file at the beginning of the process. It is working now until the launch of the new product. I recieve the following error message: "The runtime parameter of python3.6 is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (python3.9) while creating or updating functions." I already changed the runtime in the accountbuilder.yml to 3.10

asked a year ago359 views
1 Answer
0

Hi Mark,

I tested this with python3.9 and it worked fine for me. As we are already having conversation through comments, let me know if you are still stuck here. Happy to help.

profile pictureAWS
EXPERT
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions