Skip to content

[aws-eks] eks.Cluster.addCapacity is Unable to determine AMI from AMI map since stack is region-agnosticΒ #3078

@raphaelschnaitl

Description

@raphaelschnaitl
  • I'm submitting a ...

    • πŸͺ² bug report
    • πŸš€ feature request
    • πŸ“š construct library gap
    • ☎️ security issue or vulnerability => Please see policy
    • ❓ support request => Please see note at the top of this template.
  • What is the current behavior?

eks.Cluster.addCapacity does result in the following Error when running cdk synth

Error: Unable to determine AMI from AMI map since stack is region-agnostic
at EksOptimizedAmi.getImage (C:\Users\rschn\Source\KubernetesCdk\node_modules@aws-cdk\aws-ec2\lib\machine-image.ts:251:13)
at new AutoScalingGroup (C:\Users\rschn\Source\KubernetesCdk\node_modules@aws-cdk\aws-autoscaling\lib\auto-scaling-group.ts:398:44)
at Cluster.addCapacity (C:\Users\rschn\Source\KubernetesCdk\node_modules@aws-cdk\aws-eks\lib\cluster.ts:263:17)
at new EksClusterStack (C:\Users\rschn\Source\KubernetesCdk\stack\eks-cluster-stack.ts:18:31)
at Object. (C:\Users\rschn\Source\KubernetesCdk\stack\main.ts:7:1)
at Module._compile (internal/modules/cjs/loader.js:816:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)
at Module.load (internal/modules/cjs/loader.js:685:32)
at Function.Module._load (internal/modules/cjs/loader.js:620:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:877:12)

Stack to reproduce the issue:

import cdk = require('@aws-cdk/core');
import ec2 = require('@aws-cdk/aws-ec2');
import eks = require('@aws-cdk/aws-eks');

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

    const vpc = new ec2.Vpc(this, 'vpc')
    const cluster = new eks.Cluster(this, 'cluster', { vpc })

    const workerAsg = cluster.addCapacity('Nodes', {
      instanceType: new ec2.InstanceType('t2.small'),
      desiredCapacity: 2,
    });
  }
}
  • What is the expected behavior (or behavior of feature suggested)?

the stack should create a new AutoScalingGroup for the cluster, using the the EksOptimizedAmi.

  • Please tell us about your environment:

    • CDK CLI Version: 0.36.0
    • Module Version: 0.36.0
    • OS: Windows 10
    • Language: TypeScript

Metadata

Metadata

Assignees

Labels

@aws-cdk/aws-eksRelated to Amazon Elastic Kubernetes ServiceguidanceQuestion that needs advice or information.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions