Skip to main content

🧠 AWS EC2 Auto Scaling Group Launch Template is not configured to require IMDSv2 - prod.logic.yaml 🟒

Flags​

Input Type​

TypeAPI NameExtractsExtract FilesLogic Files
πŸ”’πŸ“• AWS EC2 Auto Scaling GroupCA10__CaAwsAutoScalingGroup__c615

Uses​

Test Results πŸŸ’β€‹

Generated at: 2025-06-25T13:41:05.728456259Z Open

ResultIdCondition IndexCondition TextRuntime Error
🟒test1βœ”οΈ 99βœ”οΈ isDisappeared(CA10__disappearanceTime__c)βœ”οΈ null
🟒test2βœ”οΈ 199βœ”οΈ extract('CA10__launchConfigurationName__c').isNotEmpty()βœ”οΈ null
🟒test3βœ”οΈ 299βœ”οΈ extract('CA10A1__launchTemplateId__c').isNotEmpty() && (isEmptyLookup('CA10A1__launchTemplate__r') || isEmptyLookup('CA10A1__launchTemplate__r.CA10A1__latestVersion__r'))βœ”οΈ null
🟒test4βœ”οΈ 299βœ”οΈ extract('CA10A1__launchTemplateId__c').isNotEmpty() && (isEmptyLookup('CA10A1__launchTemplate__r') || isEmptyLookup('CA10A1__launchTemplate__r.CA10A1__latestVersion__r'))βœ”οΈ null
🟒test5βœ”οΈ 399βœ”οΈ extract('CA10A1__mixedInstancesLaunchTemplateId__c').isNotEmpty() && (isEmptyLookup('CA10A1__mixedInstancesLaunchTemplate__r') || isEmptyLookup('CA10A1__mixedInstancesLaunchTemplate__r.CA10A1__latestVersion__r'))βœ”οΈ null
🟒test6βœ”οΈ 399βœ”οΈ extract('CA10A1__mixedInstancesLaunchTemplateId__c').isNotEmpty() && (isEmptyLookup('CA10A1__mixedInstancesLaunchTemplate__r') || isEmptyLookup('CA10A1__mixedInstancesLaunchTemplate__r.CA10A1__latestVersion__r'))βœ”οΈ null
🟒test7βœ”οΈ 499βœ”οΈ extract('CA10A1__launchTemplateId__c').isNotEmpty() && extract('CA10A1__launchTemplate__r.CA10A1__latestVersion__r.CA10A1__metadataHttpEndpoint__c') == 'disabled'βœ”οΈ null
🟒test8βœ”οΈ 599βœ”οΈ extract('CA10A1__mixedInstancesLaunchTemplateId__c').isNotEmpty() && extract('CA10A1__mixedInstancesLaunchTemplate__r.CA10A1__latestVersion__r.CA10A1__metadataHttpEndpoint__c') == 'disabled'βœ”οΈ null
🟒test9βœ”οΈ 699βœ”οΈ extract('CA10A1__launchTemplateId__c').isNotEmpty() && extract('CA10A1__launchTemplate__r.CA10A1__latestVersion__r.CA10A1__metadataHttpTokens__c') == 'required'βœ”οΈ null
🟒test10βœ”οΈ 799βœ”οΈ extract('CA10A1__mixedInstancesLaunchTemplateId__c').isNotEmpty() && extract('CA10A1__mixedInstancesLaunchTemplate__r.CA10A1__latestVersion__r.CA10A1__metadataHttpTokens__c') == 'required'βœ”οΈ null
🟒test11βœ”οΈ 800βœ”οΈ otherwiseβœ”οΈ null
🟒test12βœ”οΈ 800βœ”οΈ otherwiseβœ”οΈ null

Generation​

FileMD5
Open/ce/ca/aws/autoscaling/group-launch-template-imdsv2/policy.yaml2BA738690B9315E9C7CB7C6FC7A0EDC5
Open/ce/ca/aws/autoscaling/group-launch-template-imdsv2/prod.logic.yamlE373BD538ED2D1CA829149C90F27BC79
Open/ce/ca/aws/autoscaling/group-launch-template-imdsv2/test-data.json30BAABD8C965221D8C82CE87D97F01E4
Open/types/CA10__CaAwsAutoScalingGroup__c/object.extracts.yaml134069A12987447E64F62153975AC9A7
Open/types/CA10A1__CaAwsEc2LaunchTemplateVersion__c/object.extracts.yaml0CF0050EB6BA851041A4284E9AEA6611

Generate FULL script​

java -jar repo-manager.jar policies generate FULL /ce/ca/aws/autoscaling/group-launch-template-imdsv2/prod.logic.yaml

Generate DEBUG script​

java -jar repo-manager.jar policies generate DEBUG /ce/ca/aws/autoscaling/group-launch-template-imdsv2/prod.logic.yaml

Generate CAPTURE_TEST_DATA script​

java -jar repo-manager.jar policies generate CAPTURE_TEST_DATA /ce/ca/aws/autoscaling/group-launch-template-imdsv2/prod.logic.yaml

Generate TESTS script​

java -jar repo-manager.jar policies generate TESTS /ce/ca/aws/autoscaling/group-launch-template-imdsv2/prod.logic.yaml

Execute tests​

java -jar repo-manager.jar policies test /ce/ca/aws/autoscaling/group-launch-template-imdsv2/prod.logic.yaml

Content​

Open File

---
inputType: "CA10__CaAwsAutoScalingGroup__c"
importExtracts:
- file: "/types/CA10A1__CaAwsEc2LaunchTemplateVersion__c/object.extracts.yaml"
- file: "/types/CA10__CaAwsAutoScalingGroup__c/object.extracts.yaml"
testData:
- file: "test-data.json"
conditions:
- status: "INAPPLICABLE"
currentStateMessage: "The Auto Scaling group uses a launch configuration."
remediationMessage: "Consider migrating the Auto Scaling group to launch template."
check:
NOT_EMPTY:
arg:
EXTRACT: "CA10__launchConfigurationName__c"
- status: "UNDETERMINED"
currentStateMessage: "The launch template is not present in the CMDB."
check:
AND:
args:
- NOT_EMPTY:
arg:
EXTRACT: "CA10A1__launchTemplateId__c"
- OR:
args:
- IS_EMPTY_LOOKUP: "CA10A1__launchTemplate__r"
- IS_EMPTY_LOOKUP: "CA10A1__launchTemplate__r.CA10A1__latestVersion__r"
- status: "UNDETERMINED"
currentStateMessage: "The launch template is not present in the CMDB."
check:
AND:
args:
- NOT_EMPTY:
arg:
EXTRACT: "CA10A1__mixedInstancesLaunchTemplateId__c"
- OR:
args:
- IS_EMPTY_LOOKUP: "CA10A1__mixedInstancesLaunchTemplate__r"
- IS_EMPTY_LOOKUP: "CA10A1__mixedInstancesLaunchTemplate__r.CA10A1__latestVersion__r"
- status: "INCOMPLIANT"
currentStateMessage: "Access to the HTTP endpoint of the instance metadata service is disabled."
remediationMessage: "Consider enabling access to the instance metadata."
check:
AND:
args:
- NOT_EMPTY:
arg:
EXTRACT: "CA10A1__launchTemplateId__c"
- IS_EQUAL:
left:
EXTRACT: "CA10A1__launchTemplate__r.CA10A1__latestVersion__r.CA10A1__metadataHttpEndpoint__c"
right:
TEXT: "disabled"
- status: "INCOMPLIANT"
currentStateMessage: "Access to the HTTP endpoint of the instance metadata service is disabled."
remediationMessage: "Consider enabling access to the instance metadata."
check:
AND:
args:
- NOT_EMPTY:
arg:
EXTRACT: "CA10A1__mixedInstancesLaunchTemplateId__c"
- IS_EQUAL:
left:
EXTRACT: "CA10A1__mixedInstancesLaunchTemplate__r.CA10A1__latestVersion__r.CA10A1__metadataHttpEndpoint__c"
right:
TEXT: "disabled"
- status: "COMPLIANT"
currentStateMessage: "The launch template settings require IMDSv2."
check:
AND:
args:
- NOT_EMPTY:
arg:
EXTRACT: "CA10A1__launchTemplateId__c"
- IS_EQUAL:
left:
EXTRACT: "CA10A1__launchTemplate__r.CA10A1__latestVersion__r.CA10A1__metadataHttpTokens__c"
right:
TEXT: "required"
- status: "COMPLIANT"
currentStateMessage: "The launch template settings require IMDSv2."
check:
AND:
args:
- NOT_EMPTY:
arg:
EXTRACT: "CA10A1__mixedInstancesLaunchTemplateId__c"
- IS_EQUAL:
left:
EXTRACT: "CA10A1__mixedInstancesLaunchTemplate__r.CA10A1__latestVersion__r.CA10A1__metadataHttpTokens__c"
right:
TEXT: "required"
otherwise:
status: "INCOMPLIANT"
currentStateMessage: "IMDSv2 is not required when requesting instance metadata."
remediationMessage: "Configure the template to only allow IMDSv2 calls."