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

Feature/get platform from instance info #22

Merged

Conversation

GlennChia
Copy link
Contributor

@GlennChia GlennChia commented Aug 16, 2022

Issue #, if available: Closes #23

Description of changes:

There could be cases where the base AMI is unavailable (e.g. EC2 instance restored from a AWS Backup Recovery point that has since exceeded its Retention period, or an EC2 instance that was launched from an AMI that has since been deregistered).

This PR adds additional logic to retrieve the Platform details from the instance_info should they be unavailable from the image information. The describe_instances API call provides the PlatformDetails response to achieve this.

Note that Ubuntu and Amazon Linux platforms cannot be distinguished. Both return Linux/UNIX. Hence, they are not handled by this PR. This PR does however, handle Windows, Red Hat, and SUSE platforms since their Platform Details are specific.

Also adding an additional fix for detecting if ubuntu is in the image Description. Since the Description attribute is optional, this PR adds a check if it exists first before checking if ubuntu is a sub-string within it.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@GlennChia GlennChia changed the title Feat/get platform from instance info Feature/get platform from instance info Aug 16, 2022
@knizami knizami merged commit f9bd3c0 into aws-samples:main Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Check Platform from instance_info if image_info is unavailable
2 participants