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-ecs: aws-cdk-lib.aws_ecs.TaskDefinitionProps#inferenceAccelerators #33505

Open
1 task
rantoniuk opened this issue Feb 19, 2025 · 2 comments
Open
1 task
Labels
@aws-cdk/aws-ecs Related to Amazon Elastic Container bug This issue is a bug. p2

Comments

@rantoniuk
Copy link

Describe the bug

I started to see multiple instances of the same warning (for every ECS Service created):

[WARNING] aws-cdk-lib.aws_ecs.TaskDefinitionProps#inferenceAccelerators is deprecated.
  ECS TaskDefinition's inferenceAccelerator is EOL since April 2024
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_ecs.TaskDefinitionProps#inferenceAccelerators is deprecated.
  ECS TaskDefinition's inferenceAccelerator is EOL since April 2024
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_ecs.TaskDefinitionProps#inferenceAccelerators is deprecated.
  ECS TaskDefinition's inferenceAccelerator is EOL since April 2024
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_ecs.TaskDefinitionProps#inferenceAccelerators is deprecated.
  ECS TaskDefinition's inferenceAccelerator is EOL since April 2024
  This API will be removed in the next major release.

even though I am not even using that inferenceAccelerators property. I'm happy that the warning is there, but it should not be displayed if I am not using this property (without adding any flag).

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Version

No response

Expected Behavior

No warning should be displayed if property is not used.

Current Behavior

As above.

Reproduction Steps

As above.

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.178.1 (build ae342cb)

Framework Version

No response

Node.js Version

v22.14.0

OS

MacOS

Language

TypeScript

Language Version

└── [email protected]

Other information

No response

@rantoniuk rantoniuk added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Feb 19, 2025
@github-actions github-actions bot added the @aws-cdk/aws-ecs Related to Amazon Elastic Container label Feb 19, 2025
@ashishdhingra ashishdhingra self-assigned this Feb 19, 2025
@ashishdhingra ashishdhingra added p3 and removed needs-triage This issue or PR still needs to be triaged. labels Feb 19, 2025
@ashishdhingra
Copy link
Contributor

ashishdhingra commented Feb 19, 2025

Reproducible using code below:

import * as cdk from 'aws-cdk-lib';
import * as ec2 from 'aws-cdk-lib/aws-ec2';
import * as ecs from 'aws-cdk-lib/aws-ecs';

export class CdktestStackNew extends cdk.Stack {
  constructor(scope: cdk.App, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    const vpc = ec2.Vpc.fromLookup(this, 'DefaultVpc', { isDefault: true });
    // Create an ECS cluster
    const cluster = new ecs.Cluster(this, 'Cluster', { vpc });

    // Add capacity to it
    cluster.addCapacity('DefaultAutoScalingGroupCapacity', {
      instanceType: new ec2.InstanceType("t2.xlarge"),
      desiredCapacity: 3,
    });

    const taskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef');

    taskDefinition.addContainer('DefaultContainer', {
      image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"),
      memoryLimitMiB: 512,
    });

    // Instantiate an Amazon ECS Service
    const ecsService = new ecs.Ec2Service(this, 'Service', {
      cluster,
      taskDefinition,
      minHealthyPercent: 100,
    });
  }
}

Running cdk synth give the deprecation warning for inferenceAccelerator:

[WARNING] aws-cdk-lib.aws_ecs.TaskDefinitionProps#inferenceAccelerators is deprecated.
  ECS TaskDefinition's inferenceAccelerator is EOL since April 2024
  This API will be removed in the next major release.
[Warning at /CdktestStackNew/Cluster] Blocking container access to instance role will be deprecated. Use the @aws-cdk/aws-ecs:enableImdsBlockingDeprecatedFeature feature flagto keep this feature temporarily. See https://github.com/aws/aws-cdk/discussions/32609 [ack: @aws-cdk/aws-ecs:deprecatedImdsBlocking]
[Warning at /CdktestStackNew/Cluster/DefaultAutoScalingGroupCapacity] desiredCapacity has been configured. Be aware this will reset the size of your AutoScalingGroup on every deployment. See https://github.com/aws/aws-cdk/issues/5215 [ack: @aws-cdk/aws-autoscaling:desiredCapacitySet]
Resources:
  ClusterEB0386A7:
    Type: AWS::ECS::Cluster
    Metadata:
      aws:cdk:path: CdktestStackNew/Cluster/Resource
  ClusterDefaultAutoScalingGroupCapacityInstanceSecurityGroup1280FF15:
    Type: AWS::EC2::SecurityGroup
    Properties:
      GroupDescription: CdktestStackNew/Cluster/DefaultAutoScalingGroupCapacity/InstanceSecurityGroup
      SecurityGroupEgress:
        - CidrIp: 0.0.0.0/0
          Description: Allow all outbound traffic by default
          IpProtocol: "-1"
      Tags:
        - Key: Name
          Value: CdktestStackNew/Cluster/DefaultAutoScalingGroupCapacity
      VpcId: vpc-0bcd157c9276f648b
    Metadata:
      aws:cdk:path: CdktestStackNew/Cluster/DefaultAutoScalingGroupCapacity/InstanceSecurityGroup/Resource
  ClusterDefaultAutoScalingGroupCapacityInstanceRoleDDFBFB36:
...
    Type: AWS::ECS::TaskDefinition
    Properties:
      ContainerDefinitions:
        - Essential: true
          Image: amazon/amazon-ecs-sample
          Memory: 512
          Name: DefaultContainer
      Family: CdktestStackNewTaskDefEA872E55
      NetworkMode: bridge
      RequiresCompatibilities:
        - EC2
      TaskRoleArn:
        Fn::GetAtt:
          - TaskDefTaskRole1EDB4A67
          - Arn
    Metadata:
      aws:cdk:path: CdktestStackNew/TaskDef/Resource
...

Unsure if simply conditional check in CDK L2 construct code triggers this deprecation warning and if there is a way to avoid it.

@pahud
Copy link
Contributor

pahud commented Feb 19, 2025

This should not happen. While it's not really blocking customers, we need to check what's going on there. Bump to p2 and request for team's input.

@pahud pahud added p2 and removed p3 labels Feb 19, 2025
@ashishdhingra ashishdhingra removed their assignment Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-ecs Related to Amazon Elastic Container bug This issue is a bug. p2
Projects
None yet
Development

No branches or pull requests

3 participants