-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
aws - ec2 resize from cost hub recommendation #9281
Merged
Merged
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
9090acb
aws - ec2 resize from cost hub recommendation
kapilt 6fe74f9
lint
kapilt b43cb4d
add test
kapilt 584bb1f
switch test to replay
kapilt ad905f9
add doc example
kapilt 8318b02
lint
kapilt 5462023
fix doc example
kapilt 6e8423a
fix service name re optimization hub
kapilt File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
tests/data/placebo/test_ec2_costhub_resize/cost-optimization-hub.ListRecommendations_1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"status_code": 200, | ||
"data": { | ||
"items": [ | ||
{ | ||
"accountId": "644160558196", | ||
"actionType": "Rightsize", | ||
"currencyCode": "USD", | ||
"currentResourceSummary": "m5a.xlarge", | ||
"currentResourceType": "Ec2Instance", | ||
"estimatedMonthlyCost": 82.49, | ||
"estimatedMonthlySavings": 43.07, | ||
"estimatedSavingsPercentage": 35.0, | ||
"implementationEffort": "Medium", | ||
"lastRefreshTimestamp": { | ||
"__class__": "datetime", | ||
"year": 2024, | ||
"month": 2, | ||
"day": 6, | ||
"hour": 14, | ||
"minute": 31, | ||
"second": 0, | ||
"microsecond": 915000 | ||
}, | ||
"recommendationId": "NDkwMDY1ODg1ODYzX2YxNDhmM2ExLWUyNDQtNGM5ZC1iMDkxLTEzMjQwZTZjNGYxYg==", | ||
"recommendationLookbackPeriodInDays": 14, | ||
"recommendedResourceSummary": "r5a.large", | ||
"recommendedResourceType": "Ec2Instance", | ||
"region": "us-east-2", | ||
"resourceArn": "arn:aws:ec2:us-east-2:644160558196:instance/i-000ce83ee0c70e572", | ||
"resourceId": "i-000ce83ee0c70e572", | ||
"restartNeeded": true, | ||
"rollbackPossible": true, | ||
"source": "ComputeOptimizer", | ||
"tags": [] | ||
} | ||
], | ||
"ResponseMetadata": {} | ||
} | ||
} |
195 changes: 195 additions & 0 deletions
195
tests/data/placebo/test_ec2_costhub_resize/ec2.DescribeInstances_1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,195 @@ | ||
{ | ||
"status_code": 200, | ||
"data": { | ||
"Reservations": [ | ||
{ | ||
"Groups": [], | ||
"Instances": [ | ||
{ | ||
"AmiLaunchIndex": 0, | ||
"ImageId": "ami-00399ec92321828f5", | ||
"InstanceId": "i-000ce83ee0c70e572", | ||
"InstanceType": "m5a.xlarge", | ||
"KeyName": "kapil-sandbox-us-east-2", | ||
"LaunchTime": { | ||
"__class__": "datetime", | ||
"year": 2021, | ||
"month": 10, | ||
"day": 13, | ||
"hour": 14, | ||
"minute": 59, | ||
"second": 51, | ||
"microsecond": 0 | ||
}, | ||
"Monitoring": { | ||
"State": "disabled" | ||
}, | ||
"Placement": { | ||
"AvailabilityZone": "us-east-2a", | ||
"GroupName": "", | ||
"Tenancy": "default" | ||
}, | ||
"PrivateDnsName": "ip-172-31-4-66.us-east-2.compute.internal", | ||
"PrivateIpAddress": "172.31.4.66", | ||
"ProductCodes": [], | ||
"PublicDnsName": "", | ||
"State": { | ||
"Code": 80, | ||
"Name": "stopped" | ||
}, | ||
"StateTransitionReason": "User initiated (2024-02-08 17:03:16 GMT)", | ||
"SubnetId": "subnet-04d3383552d0e5fcb", | ||
"VpcId": "vpc-0011443044d315155", | ||
"Architecture": "x86_64", | ||
"BlockDeviceMappings": [ | ||
{ | ||
"DeviceName": "/dev/sda1", | ||
"Ebs": { | ||
"AttachTime": { | ||
"__class__": "datetime", | ||
"year": 2021, | ||
"month": 10, | ||
"day": 13, | ||
"hour": 14, | ||
"minute": 59, | ||
"second": 52, | ||
"microsecond": 0 | ||
}, | ||
"DeleteOnTermination": true, | ||
"Status": "attached", | ||
"VolumeId": "vol-07ce74970f20cf68b" | ||
} | ||
} | ||
], | ||
"ClientToken": "", | ||
"EbsOptimized": true, | ||
"EnaSupport": true, | ||
"Hypervisor": "xen", | ||
"IamInstanceProfile": { | ||
"Arn": "arn:aws:iam::644160558196:instance-profile/assetdb-functional", | ||
"Id": "AIPAXEGRT7KTUCEPDUG3Y" | ||
}, | ||
"NetworkInterfaces": [ | ||
{ | ||
"Attachment": { | ||
"AttachTime": { | ||
"__class__": "datetime", | ||
"year": 2021, | ||
"month": 10, | ||
"day": 13, | ||
"hour": 14, | ||
"minute": 59, | ||
"second": 51, | ||
"microsecond": 0 | ||
}, | ||
"AttachmentId": "eni-attach-0f1d706dba234a4d6", | ||
"DeleteOnTermination": true, | ||
"DeviceIndex": 0, | ||
"Status": "attached", | ||
"NetworkCardIndex": 0 | ||
}, | ||
"Description": "", | ||
"Groups": [ | ||
{ | ||
"GroupName": "launch-wizard-1", | ||
"GroupId": "sg-08b7e147e621bbd7f" | ||
} | ||
], | ||
"Ipv6Addresses": [], | ||
"MacAddress": "02:2f:0b:3b:64:be", | ||
"NetworkInterfaceId": "eni-078156fca4353cd1a", | ||
"OwnerId": "644160558196", | ||
"PrivateDnsName": "ip-172-31-4-66.us-east-2.compute.internal", | ||
"PrivateIpAddress": "172.31.4.66", | ||
"PrivateIpAddresses": [ | ||
{ | ||
"Primary": true, | ||
"PrivateDnsName": "ip-172-31-4-66.us-east-2.compute.internal", | ||
"PrivateIpAddress": "172.31.4.66" | ||
} | ||
], | ||
"SourceDestCheck": true, | ||
"Status": "in-use", | ||
"SubnetId": "subnet-04d3383552d0e5fcb", | ||
"VpcId": "vpc-0011443044d315155", | ||
"InterfaceType": "interface" | ||
} | ||
], | ||
"RootDeviceName": "/dev/sda1", | ||
"RootDeviceType": "ebs", | ||
"SecurityGroups": [ | ||
{ | ||
"GroupName": "launch-wizard-1", | ||
"GroupId": "sg-08b7e147e621bbd7f" | ||
} | ||
], | ||
"SourceDestCheck": true, | ||
"StateReason": { | ||
"Code": "Client.UserInitiatedShutdown", | ||
"Message": "Client.UserInitiatedShutdown: User initiated shutdown" | ||
}, | ||
"Tags": [ | ||
{ | ||
"Key": "ActionNeeded", | ||
"Value": "Investigate shutting down or terminating this EC2 instance which is over 365 days old" | ||
}, | ||
{ | ||
"Key": "CostSavingsEligible", | ||
"Value": "True" | ||
}, | ||
{ | ||
"Key": "Owner", | ||
"Value": "kapil@stacklet.io" | ||
} | ||
], | ||
"VirtualizationType": "hvm", | ||
"CpuOptions": { | ||
"CoreCount": 2, | ||
"ThreadsPerCore": 2 | ||
}, | ||
"CapacityReservationSpecification": { | ||
"CapacityReservationPreference": "open" | ||
}, | ||
"HibernationOptions": { | ||
"Configured": false | ||
}, | ||
"MetadataOptions": { | ||
"State": "applied", | ||
"HttpTokens": "optional", | ||
"HttpPutResponseHopLimit": 1, | ||
"HttpEndpoint": "enabled", | ||
"HttpProtocolIpv6": "disabled", | ||
"InstanceMetadataTags": "disabled" | ||
}, | ||
"EnclaveOptions": { | ||
"Enabled": false | ||
}, | ||
"PlatformDetails": "Linux/UNIX", | ||
"UsageOperation": "RunInstances", | ||
"UsageOperationUpdateTime": { | ||
"__class__": "datetime", | ||
"year": 2021, | ||
"month": 10, | ||
"day": 13, | ||
"hour": 14, | ||
"minute": 59, | ||
"second": 51, | ||
"microsecond": 0 | ||
}, | ||
"PrivateDnsNameOptions": { | ||
"HostnameType": "ip-name", | ||
"EnableResourceNameDnsARecord": false, | ||
"EnableResourceNameDnsAAAARecord": false | ||
}, | ||
"MaintenanceOptions": { | ||
"AutoRecovery": "default" | ||
} | ||
} | ||
], | ||
"OwnerId": "644160558196", | ||
"ReservationId": "r-06e021d3accdc77a2" | ||
} | ||
], | ||
"ResponseMetadata": {} | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the endpoint for hub is only in us-east-1, that endpoint does hold data for other regions