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

(ec2): using ARM-based instances in BastionHostLinux results in an invalid instance configuration #12279

Closed
Jacob-Doetsch opened this issue Dec 30, 2020 · 1 comment · Fixed by #12280
Assignees
Labels
@aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud bug This issue is a bug. effort/medium Medium work item – several days of effort needs-triage This issue or PR still needs to be triaged. p2

Comments

@Jacob-Doetsch
Copy link
Contributor

Jacob-Doetsch commented Dec 30, 2020

Deployment of a stack containing a BastionHostLinux construct backed by an ARM-based instance (e.g., a1, t4g, etc) will fail, with CloudFormation reporting the following for the EC2 instance resource:

't4g.nano' is not a valid instance type for instance 'i-*********' of architecture 'x86_64'. (Service: AmazonEC2; Status Code: 400; Error Code: InvalidInstanceAttributeValue; Request ID: ********; Proxy: null)

Reproduction Steps

The following stack will fail during deployment:

const cdk = require('@aws-cdk/core');
const ec2 = require('@aws-cdk/aws-ec2');
class BastionHostReproStack extends cdk.Stack {

  constructor(scope, id, props) {
    super(scope, id, props);

    this.vpc = new ec2.Vpc(this, 'Vpc');
    new ec2.BastionHostLinux(this, 'BastionHost', {
      vpc: this.vpc,
      instanceType: ec2.InstanceType.of(ec2.InstanceClass.T4G, ec2.InstanceSize.NANO),
    });
  }
}

module.exports = { BastionHostReproStack }

What did you expect to happen?

The stack should deploy successfully when using an instanceType on BastionHostLinux that has an InstanceClass with an ARM architecture.

What actually happened?

CloudFormation will report the following for the backing EC2 instance:

't4g.nano' is not a valid instance type for instance 'i-*********' of architecture 'x86_64'. (Service: AmazonEC2; Status Code: 400; Error Code: InvalidInstanceAttributeValue; Request ID: ********; Proxy: null)

Environment

  • CDK CLI Version : 1.80
  • Framework Version: 1.80
  • Node.js Version: 15.2.1
  • OS : Ubuntu (WSL2)
  • Language (Version): TypeScript, JavaScript

Other

In the constructor of BastionHostLinux, the architecture of the instanceType is assumed to be x86-64, and so the Amazon Linux 2 X86-64 AMI is always used for the backing EC2 instance even if the instanceType uses an instance class that is ARM-based. This explains the error reported by CloudFormation.
Furthermore, only the x86-64 SSM Agent rpm is installed via UserData.

Proposed fix at #12280


This is 🐛 Bug Report

@Jacob-Doetsch Jacob-Doetsch added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Dec 30, 2020
@github-actions github-actions bot added the @aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud label Dec 30, 2020
Jacob-Doetsch added a commit to Jacob-Doetsch/aws-cdk that referenced this issue Dec 30, 2020
…ws#12279)

Adds support for ARM-based instance types used with BastionHostLinux: identifies ARM-based instance types and uses the architecutre-appropriate Amazon Linux 2 AMI and SSM Agent package.

Fixes aws#12279
Jacob-Doetsch added a commit to Jacob-Doetsch/aws-cdk that referenced this issue Dec 30, 2020
…ws#12279)

Adds support for ARM-based instance types used with BastionHostLinux: identifies ARM-based instance types and uses the architecutre-appropriate Amazon Linux 2 AMI and SSM Agent package.

Fixes aws#12279
Jacob-Doetsch added a commit to Jacob-Doetsch/aws-cdk that referenced this issue Dec 30, 2020
…ws#12279)

Adds support for ARM-based instance types used with BastionHostLinux: identifies ARM-based instance types and uses the architecutre-appropriate Amazon Linux 2 AMI and SSM Agent package.

Fixes aws#12279
Jacob-Doetsch added a commit to Jacob-Doetsch/aws-cdk that referenced this issue Dec 31, 2020
…ws#12279)

Adds support for ARM-based instance types used with BastionHostLinux: identifies ARM-based instance types and uses the architecutre-appropriate Amazon Linux 2 AMI and SSM Agent package.

Fixes aws#12279
Jacob-Doetsch added a commit to Jacob-Doetsch/aws-cdk that referenced this issue Jan 3, 2021
…ws#12279)

Adds support for ARM-based instance types used with BastionHostLinux: identifies ARM-based instance types and uses the architecutre-appropriate Amazon Linux 2 AMI and SSM Agent package.

Fixes aws#12279
Jacob-Doetsch added a commit to Jacob-Doetsch/aws-cdk that referenced this issue Jan 4, 2021
…ws#12279)

Adds support for ARM-based instance types used with BastionHostLinux: identifies ARM-based instance types and uses the architecutre-appropriate Amazon Linux 2 AMI and SSM Agent package.

Fixes aws#12279
@rix0rrr rix0rrr added effort/medium Medium work item – several days of effort p2 labels Jan 5, 2021
@mergify mergify bot closed this as completed in #12280 Jan 27, 2021
mergify bot pushed a commit that referenced this issue Jan 27, 2021
…AMI (#12280)

Fixes #12279

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@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-ec2 Related to Amazon Elastic Compute Cloud bug This issue is a bug. effort/medium Medium work item – several days of effort needs-triage This issue or PR still needs to be triaged. p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants