aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

ec2: Need G6 EC2 Instance support

Open CambioML opened this issue 1 year ago • 2 comments

Describe the feature

Need G6 EC2 Instance support

Use Case

Need to provision ECS EC2 while using G6 instance

Proposed Solution

No response

Other Information

No response

Acknowledgements

  • [ ] I may be able to implement this feature request
  • [ ] This feature might incur a breaking change

CDK version used

^2.1.0

Environment details (OS name and version, etc.)

mac 14.5

CambioML avatar Jun 26 '24 16:06 CambioML

Per Amazon EC2 instance types, G6 is one of the supported instance types. However, it not an option in InstanceClass. The probable workaround is to use L1 construct.

@CambioML Thanks for bringing this issue into our attention. Feel free to contribute PR to add G6 EC2 instance type.

ashishdhingra avatar Jun 26 '24 19:06 ashishdhingra

@CambioML

Before we have a PR to natively support that, you can override the InstanceType like this:

// create a dummy ec2 instance
    const instance = new ec2.Instance(this, 'Instance', {
      machineImage: ec2.MachineImage.latestAmazonLinux2023(),
      instanceType: ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.SMALL),
      vpc: ec2.Vpc.fromLookup(this, 'Vpc', { isDefault: true }),
    });

   (instance.node.defaultChild as ec2.CfnInstance).addPropertyOverride('InstanceType', 'g6.xlarge');

verify:

% npx cdk synth dummy-stack1 | grep InstanceType
      InstanceType: g6.xlarge

And you will need to specify appropriate AMI as well.

Let me know if it works for you and we welcome any pull requests for this.

pahud avatar Jun 26 '24 19:06 pahud

⚠️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.

github-actions[bot] avatar Jul 18 '24 18:07 github-actions[bot]

Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one.

aws-cdk-automation avatar Jul 25 '24 17:07 aws-cdk-automation