-
Notifications
You must be signed in to change notification settings - Fork 4k
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] make GenericMachineImage use CfnMapping in an agnostic stack #8759
Labels
@aws-cdk/aws-ec2
Related to Amazon Elastic Compute Cloud
effort/small
Small work item – less than a day of effort
feature-request
A feature should be added or improved.
good first issue
Related to contributions. See CONTRIBUTING.md
p2
Comments
vgribok
added
feature-request
A feature should be added or improved.
needs-triage
This issue or PR still needs to be triaged.
labels
Jun 26, 2020
SomayaB
changed the title
[Amazon.CDK.AWS.EC2] EC2 MachineImage in CDK is not region-agnostic, while in CFN this use case is supported
[EC2] EC2 MachineImage in CDK is not region-agnostic, while in CFN this use case is supported
Jun 29, 2020
github-actions
bot
added
the
@aws-cdk/aws-ec2
Related to Amazon Elastic Compute Cloud
label
Jun 29, 2020
You are right, that change shouldn't be too hard. |
rix0rrr
added
effort/small
Small work item – less than a day of effort
good first issue
Related to contributions. See CONTRIBUTING.md
labels
Jul 8, 2020
rix0rrr
changed the title
[EC2] EC2 MachineImage in CDK is not region-agnostic, while in CFN this use case is supported
[EC2] make GenericMachineImage use CfnMapping in an agnostic stack
Jul 8, 2020
wchaws
added a commit
to wchaws/aws-cdk
that referenced
this issue
Jan 16, 2021
wchaws
added a commit
to wchaws/aws-cdk
that referenced
this issue
Jan 16, 2021
wchaws
added a commit
to wchaws/aws-cdk
that referenced
this issue
Jan 17, 2021
wchaws
added a commit
to wchaws/aws-cdk
that referenced
this issue
Jan 17, 2021
|
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
effort/small
Small work item – less than a day of effort
feature-request
A feature should be added or improved.
good first issue
Related to contributions. See CONTRIBUTING.md
p2
CDK demands AWS Region to be known at synth time when resolving IMachineImage for the EC2 Instance class, seemingly making it impossible to create a region-agnostic stack for launching an EC2 instance, while it's perfectly possible to defer region resolution in plain vanilla CFN to the run/deploy time.
Use Case
I need a stack that can launch an EC2 in any region. CFN allows to do that via a Mapping that maps AMI Id to a region.
Consider this CFN snippet:
This shows how specifying instance AMI Id can be made region-agnostic.
When attempting to do this in CDK:
... I am getting "Amazon.JSII.Runtime.JsiiException: Unable to determine AMI from AMI map since stack is region-agnostic" error.
Proposed Solution
Instead of throwing an exception when AWS region is not specified at synth time, use region-AMI dictionary that CDK already requires to generate CFN Mapping, outputting the Mapping into generated template, so that whatever the Aws.REGION is at run time, that region value could be used.
Other
This is a 🚀 Feature Request
The text was updated successfully, but these errors were encountered: