Closed qubetzl closed 2 years ago
Hello,
AWS has started to hide old AMI's: https://aws.amazon.com/about-aws/whats-new/2022/03/amazon-machine-images-public-visibility-two-years/
You can still find the AMI if you use IncludeDeprecated when calling describeImages.
This issue is fixed with Pull Request #997
@jplock When will this be released?
Is there a good reason to prefer an image built in November 2018, instead of one built in July 2022 for this?
I have been using my patch for the past week and have not ran into issues with internet connectivity. Since I did not have any problems, I am no longer concerned about the selected AMI.
I don't think that allowing deprecated images would be the right call here.
@harmjan85 If you are interested, I have solved the problem in CI by applying my patch after installing the plugins and before running serverless.
vpc-plugin-nat-ami-name-filter.patch:
--- node_modules/serverless-vpc-plugin/src/index.js 2022-08-29 10:06:34.369588202 +0300
+++ node_modules/serverless-vpc-plugin/src/index.js 2022-08-29 10:06:28.022416017 +0300
@@ -165,7 +165,7 @@
if (createNatInstance) {
this.serverless.cli.log('Finding latest VPC NAT Instance AMI...');
- const images = await this.getImagesByName('amzn-ami-vpc-nat-hvm*');
+ const images = await this.getImagesByName('amzn-ami-vpc-nat*');
if (Array.isArray(images) && images.length > 0) {
[vpcNatAmi] = images;
} else {
Applying the patch:
patch --forward -p0 < vpc-plugin-nat-ami-name-filter.patch
The --forward
would not apply the patch if it is already applied (i.e. the patch is upstreamed). This allows your CI to not fail for not being able to apply the patch.
Hello,
Recently, I ran into a problem with finding an AMI for NAT instance creation.
I've already spent some time on this and figured out that Amazon has changed the naming convention for their NAT AMIs. They are no longer including the virtualization type in the AMI name.
Example:
This caused the newer AMIs to be filtered out by the filter applied here: https://github.com/smoketurner/serverless-vpc-plugin/blob/adb0494162ce79613f540d016c18e3d211951ff7/src/index.js#L396-L399
I have a patch ready, which seems to solve the problem. It finds:
ami-027ec8cf931500e04
(name:amzn-ami-vpc-nat-2018.03.0.20220705.1-x86_64-ebs
) ineu-central-1
, which looks like the latest one.I don't know enough to be able to tell for certain that this should be the selected image. I only assume it is the correct one, based on its name.
Before patch:
After patch:
In regards to contributing:
I created this issue to explain the problem with more detail and because I did not find specific instructions on how to contribute. I ran your test suite, but it seems to be failing even without my changes. I assume that is related to #571 and have ignored it. I've forked this repository and have pushed my changes here: https://github.com/qubetzl/serverless-vpc-plugin
I guess, when creating the PR it should be enough for me to provide a shorter description of the problem and a reference to this issue. Is there anything else I should be aware of?