Skip to main content

🧠 AWS EC2 Image is unused - prod.logic.yaml🟢

Uses

Test Results 🟢

Generated at: 2025-12-27T12:01:48.590805741Z Open

ResultIdCondition IndexCondition TextRuntime Error
🟢test1✔️ 99✔️ isDisappeared(CA10__disappearanceTime__c)✔️ null
🟢test2✔️ 199✔️ extract('CA10__state__c') != 'available'✔️ null
🟢test3✔️ 299✔️ extract('CA10__creationDate__c').withinLastDays(90)✔️ null
🟢test4✔️ 499✔️ CA10__AWS_EC2_Instances__r.has(COMPLIANT)✔️ null
🟢test5✔️ 500✔️ otherwise✔️ null
🟢test6✔️ 399✔️ extract('CA10__lastLaunchedTime__c').withinLastDays(90)✔️ null

Generation Bundle

FileMD5
Open/ce/ca/aws/ec2/image-unused/policy.yaml7571FAD82949F1B0E804F3FC516B410D
Open/ce/ca/aws/ec2/image-unused/prod.logic.yaml9A899577E8A083B704925E7E57169045
Open/ce/ca/aws/ec2/image-unused/test-data.json9EBD57C188E8969733EB9111D53AA33C
Open/types/CA10__CaAwsImage__c/object.extracts.yamlC8CCEBD443D124E5F81FD189F4E6E404

Available Commands

repo-manager policies generate FULL /ce/ca/aws/ec2/image-unused/prod.logic.yaml
repo-manager policies generate DEBUG /ce/ca/aws/ec2/image-unused/prod.logic.yaml
repo-manager policies generate CAPTURE_TEST_DATA /ce/ca/aws/ec2/image-unused/prod.logic.yaml
repo-manager policies generate TESTS /ce/ca/aws/ec2/image-unused/prod.logic.yaml
# Execute tests
repo-manager policies test /ce/ca/aws/ec2/image-unused/prod.logic.yaml

Content

Open File

---
inputType: "CA10__CaAwsImage__c"
importExtracts:
- file: "/types/CA10__CaAwsImage__c/object.extracts.yaml"
testData:
- file: "test-data.json"
conditions:
- status: "INAPPLICABLE"
currentStateMessage: "The AMI is not available."
check:
NOT_EQUAL:
left:
EXTRACT: "CA10__state__c"
right:
TEXT: "available"
- status: "INAPPLICABLE"
currentStateMessage: "The AMI was created less than 90 days ago."
check:
IS_WITHIN_LAST_DAYS:
offsetDays: 90
arg:
EXTRACT: "CA10__creationDate__c"
- status: "COMPLIANT"
currentStateMessage: "The AMI was used within the last 90 days."
check:
IS_WITHIN_LAST_DAYS:
offsetDays: 90
arg:
EXTRACT: "CA10__lastLaunchedTime__c"
- status: "COMPLIANT"
currentStateMessage: "The AMI is currently in use by one or more EC2 instances."
check:
RELATED_LIST_HAS:
status: "COMPLIANT"
relationshipName: "CA10__AWS_EC2_Instances__r"
otherwise:
status: "INCOMPLIANT"
currentStateMessage: "The AMI wasn't used within the last 90 days and has no associated running instances."
remediationMessage: "Deregister the AMI and delete its associated EBS snapshots to save costs."
relatedLists:
- relationshipName: "CA10__AWS_EC2_Instances__r"
conditions: []
otherwise:
status: "COMPLIANT"
currentStateMessage: "The EC2 Instance exists."