Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include deprecated AMIs when creating light stemcell
After a max of 2 years, AWS "deprecates" public AMIs, which means that they do not show up in `DescribeImages` API calls. (You can still use them as long as you know their ID) This leads to an error like the following when using > 2-year-old (and therefore deprecated) stemcell AMIs: ``` bosh us https://bosh.io/d/stemcells/bosh-aws-xen-hvm-ubuntu-xenial-go_agent?v=621.125 Using environment '10.0.16.10' as client 'ops_manager' Task 10 Task 10 | 23:24:10 | Update stemcell: Downloading remote stemcell (00:00:01) Task 10 | 23:24:11 | Update stemcell: Verifying remote stemcell (00:00:00) Task 10 | 23:24:11 | Update stemcell: Extracting stemcell archive (00:00:00) Task 10 | 23:24:11 | Update stemcell: Verifying stemcell manifest (00:00:00) Task 10 | 23:24:16 | Update stemcell: Checking if this stemcell already exists (cpi: 543ec2c1aa4f72578fa3) (00:00:00) Task 10 | 23:24:16 | Update stemcell: Uploading stemcell bosh-aws-xen-hvm-ubuntu-xenial-go_agent/621.125 to the cloud (cpi: 543ec2c1aa4f72578fa3) (00:00:02) L Error: CPI error 'Bosh::Clouds::CloudError' with message 'Stemcell does not contain an AMI in region us-west-1' in 'create_stemcell' CPI method (CPI request ID: 'cpi-457127') Task 10 | 23:24:18 | Error: CPI error 'Bosh::Clouds::CloudError' with message 'Stemcell does not contain an AMI in region us-west-1' in 'create_stemcell' CPI method (CPI request ID: 'cpi-457127') Task 10 Started Wed Nov 15 23:24:10 UTC 2023 Task 10 Finished Wed Nov 15 23:24:18 UTC 2023 Task 10 Duration 00:00:08 Task 10 error Uploading remote stemcell 'https://bosh.io/d/stemcells/bosh-aws-xen-hvm-ubuntu-xenial-go_agent?v=621.125': Expected task '10' to succeed but state is 'error' Exit code 1 ``` Even though the CPI knows the exact AMI ID of the stemcell image, it makes a `DescribeImages` call when creating a light stemcell. The AWS SDK allows for an `include_deprecated` option when making the call, and adding that option solves the issue. Reference: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ami-deprecate.html [#186468123]
- Loading branch information