question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@aws-cdk/aws-ec2: Wrong enum declare enum AmazonLinuxKernel

See original GitHub issue

Describe the bug

the enum declare enum AmazonLinuxKernel return 5.10 as latest kernel where it should be 5.15 for AMAZON_LINUX_2022 This leads to an error in CDK when trying to deploy:

failed: Error [ValidationError]: Unable to fetch parameters [/aws/service/ami-amazon-linux-latest/al2022-ami-kernel-5.10-x86_64] from parameter store for this account.
    at Request.extractError (/home/adonis/work/FOLDER/FOLDER-cicd/CORE/node_modules/node_modules/aws-sdk/lib/protocol/query.js:50:29)
    at Request.callListeners (/home/adonis/work/FOLDER/FOLDER-cicd/CORE/node_modules/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
    at Request.emit (/home/adonis/work/FOLDER/FOLDER-cicd/CORE/node_modules/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
    at Request.emit (/home/adonis/work/FOLDER/FOLDER-cicd/CORE/node_modules/node_modules/aws-sdk/lib/request.js:686:14)
    at Request.transition (/home/adonis/work/FOLDER/FOLDER-cicd/CORE/node_modules/node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/home/adonis/work/FOLDER/FOLDER-cicd/CORE/node_modules/node_modules/aws-sdk/lib/state_machine.js:14:12)
    at /home/adonis/work/FOLDER/FOLDER-cicd/CORE/node_modules/node_modules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (/home/adonis/work/FOLDER/FOLDER-cicd/CORE/node_modules/node_modules/aws-sdk/lib/request.js:38:9)
    at Request.<anonymous> (/home/adonis/work/FOLDER/FOLDER-cicd/CORE/node_modules/node_modules/aws-sdk/lib/request.js:688:12)
    at Request.callListeners (/home/adonis/work/FOLDER/FOLDER-cicd/CORE/node_modules/node_modules/aws-sdk/lib/sequential_executor.js:116:18) {
  code: 'ValidationError',
  time: 2022-07-06T10:59:21.163Z,
  requestId: '4b933ef2-11b7-4525-8ac2-59252ad34825',
  statusCode: 400,
  retryable: false,
  retryDelay: 311.0208741007581
}

Unable to fetch parameters [/aws/service/ami-amazon-linux-latest/al2022-ami-kernel-5.10-x86_64] from parameter store for this account.

Expected Behavior

to return 5.15

Current Behavior

it returns 5.10

Reproduction Steps

new ec2.Instance(that, "id", {
    instanceName: "name",
    vpc: options.vpc,
    instanceType: ec2.InstanceType.of(
      ec2.InstanceClass.T3A,
      ec2.InstanceSize.MICRO
    ),
    machineImage: new ec2.AmazonLinuxImage({
      generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2022,
    }),
    vpcSubnets: {
      subnetType: ec2.SubnetType.PUBLIC,
    },
    securityGroup: securityGroup,
    keyName: "key",
    userData: ec2.UserData.custom(
      fs.readFileSync("./lib/scripts/ssh-tunnel.sh", "utf8")
    ),
  });

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

1.162.0 (build 0bad87b)

Framework Version

No response

Node.js Version

v16.13.1

OS

Linux (X86_64)

Language

Typescript

Language Version

4.6.3

Other information

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:9
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
486commented, Aug 23, 2022

So just for the record, a workaround is to look up a valid image here and directly reference the SSM parameter like so?

machineImage: ec2.MachineImage.fromSsmParameter('/aws/service/ami-amazon-linux-latest/al2022-ami-kernel-5.15-x86_64')

1reaction
peterwoodworthcommented, Aug 3, 2022

Thanks for the contribution @tomfa! We should be able to take a look soon

Read more comments on GitHub >

github_iconTop Results From Across the Web

enum — Support for enumerations — Python 3.11.1 ...
Instances are replaced with an appropriate value for Enum members. StrEnum defaults to the lower-cased version of the member name, while other Enums...
Read more >
c++ - enum class nested in a class compiles on Linux, but not ...
The declaration is ill-formed pre-C++11 which is why you then get the following errors. This is not specific to the enum class being...
Read more >
Enumeration declaration - cppreference.com
An enumeration is a distinct type whose value is restricted to a range of values (see below for details), which may include several ......
Read more >
Handbook - Enums - TypeScript
Enums allow a developer to define a set of named constants. ... It is a compile time error for constant enum expressions to...
Read more >
Enumeration types - C# reference - Microsoft Learn
An enumeration type (or enum type) is a value type defined by a set of named constants of the underlying integral numeric type....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found