Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws_lambda: AutoScalingGroupDrainECSHookFunction cannot be deployed because python3.6 #21366

Closed
sandra-selfdecode opened this issue Jul 28, 2022 · 4 comments
Assignees
Labels
@aws-cdk/aws-lambda Related to AWS Lambda bug This issue is a bug. needs-discussion This issue/PR requires more discussion with community.

Comments

@sandra-selfdecode
Copy link

sandra-selfdecode commented Jul 28, 2022

Describe the bug

When deploying an EcsCluster with an AutoscalingGroup and AsgCapacityProvider, the AutoScalingGroupDrainECSHookFunction cannot be deployed because it is python3.6. The same stack deployed successfully yesterday, but today I get an error:

Resource handler returned 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 tried aws-cdk versions 2.27.0 through 2.33.0

Expected Behavior

Stack to deploy successfully

Current Behavior

Stack cannot deploy

12:47:51 PM | CREATE_FAILED        | AWS::Lambda::Function                         | ClusterEcsClusterD...okFunction83
69624A
Resource handler returned 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. (Service:
Lambda, Status Code: 400, Request ID: 8af04eeb-6dba-40f1-b67e-8be8a7fe9182)" (RequestToken: 88ff62aa-9504-c8c5-fc89-31
cf7f4ee9cc, HandlerErrorCode: InvalidRequest)


 ❌  file-processing-dev failed: Error: The stack named file-processing-dev failed creation, it may need to be manually deleted
from the AWS console: 
ROLLBACK_COMPLETE: Resource handler returned 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. (Service: Lambda, Status Code: 400, Request ID: 8af04eeb-6dba-40f1-b67e-
8be8a7fe9182)" (RequestToken: 88ff62aa-9504-c8c5-fc89-31cf7f4ee9cc, HandlerErrorCode: InvalidRequest)
    at prepareAndExecuteChangeSet (/usr/lib/node_modules/aws-cdk/lib/api/deploy-stack.ts:385:13)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at CdkToolkit.deploy (/usr/lib/node_modules/aws-cdk/lib/cdk-toolkit.ts:209:24)
    at initCommandLine (/usr/lib/node_modules/aws-cdk/lib/cli.ts:341:12)

The stack named file-processing-dev failed creation, it may need to be manually deleted from the AWS console: 
ROLLBACK_COMPLETE: Resource handler returned 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. (Service: Lambda, Status Code: 400, Request ID: 8af04eeb-6dba-40f1-b67e-8be8a7fe9182)" 
(RequestToken: 88ff62aa-9504-c8c5-fc89-31cf7f4ee9cc, HandlerErrorCode: InvalidRequest)

Reproduction Steps

        ecs_cluster = ecs.Cluster(
            self,
            "EcsCluster",
            vpc=default_vpc.vpc,
            capacity=ecs.AddCapacityOptions(
                can_containers_access_instance_role=True,
                machine_image=ecs.EcsOptimizedImage.amazon_linux2(),
                instance_type=ec2.InstanceType.of(
                    ec2.InstanceClass.MEMORY5_AMD, ec2.InstanceSize.XLARGE
                ),
                spot_instance_draining=True,
                spot_price="0.226",
                min_capacity=0,
                max_capacity=5,
            ),
        )

        ecs_cluster.autoscaling_group.scale_on_cpu_utilization(
            "AutoScaleCPU", target_utilization_percent=75
        )
        ecs_cluster.autoscaling_group.add_security_group(ecs_container_security_group)

        capacity_provider = ecs.AsgCapacityProvider(
            self,
            "AsgCapacityProvider",
            auto_scaling_group=ecs_cluster.autoscaling_group,
        )

        ecs_cluster.add_asg_capacity_provider(capacity_provider)

cdk deploy

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.33.0

Framework Version

No response

Node.js Version

18.6.0

OS

ubuntu

Language

Python

Language Version

No response

Other information

No response

@sandra-selfdecode sandra-selfdecode added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jul 28, 2022
@github-actions github-actions bot added the @aws-cdk/aws-lambda Related to AWS Lambda label Jul 28, 2022
@yahor-mikheyenka-wttech
Copy link

yahor-mikheyenka-wttech commented Jul 29, 2022

Same problem here. Can you please write an update with the cause of the error and how to fix it?
Thx

@kaizencc
Copy link
Contributor

I'm curious, can you double check in package.json your aws-cdk-lib version?

To be clear, we moved all of our custom resources to python3.9 in this commit, including this custom resource. It was released in CDK v2.28.

I ran this on aws-cdk-lib v2.33 and it succeeded.

@kaizencc kaizencc added needs-discussion This issue/PR requires more discussion with community. and removed needs-triage This issue or PR still needs to be triaged. labels Jul 29, 2022
@sandra-selfdecode
Copy link
Author

That's the problem, our devops team froze aws-cdk-lib at an earlier version. Thank you, I'll upgrade it

@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-lambda Related to AWS Lambda bug This issue is a bug. needs-discussion This issue/PR requires more discussion with community.
Projects
None yet
Development

No branches or pull requests

3 participants