diff --git a/README.md b/README.md index 5f29867..016bbc2 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Reserved Instances Tool ## Introduction -This tool is to manage your Reserved Instances in AWS across all you linked accounts. The tool reads your live configuration (instances and reserved instances) in all your accounts using the AWS API, and produce a set of recommendations to optimize your RI usage. The tool can apply the modifications in your RIs (changing the availability zone, instance type or network allocation) for you, and you can configure it to apply all the recommendations automatically every so often. +This tool is to manage your Reserved Instances in AWS across all your linked accounts. The tool reads your live configuration (instances and reserved instances) in all your accounts using the AWS API, and produces a set of recommendations to optimize your RI usage. The tool can apply the modifications in your RIs (changing the availability zone, instance type or network allocation) for you, and you can configure it to apply all the recommendations automatically every so often. > **Note:** Now the tool supports the instance types "Windows with SQL Standard", "Windows with SQL Web", "Windows with SQL Enterprise", "RHEL" and "SLES". If you're using any of these instance types you should configure the DBR file. @@ -11,7 +11,7 @@ You can use the tool with one account, or a group of accounts (linked accounts). If you have multiple accounts, you can deploy the tool in any of them (let's call the account where you're going to deploy the tool account1), then you should create a role in each account. Go to the AWS Console, and select the Identity & Access Management (IAM) service. Select Roles and create a new one. -For each account where you're not going to deploy the tool (so for all but account1), name the role "reservedinstances", select the option "Role for Cross-Account Access"and select "Provide access between AWS accounts you own". Introduce the account id for account1. Create the rol and then attach this policy to it: +For each account where you're not going to deploy the tool (so for all but account1), name the role "reservedinstances", select the option "Role for Cross-Account Access"and select "Provide access between AWS accounts you own". Introduce the account id for account1. Create the role and then attach this policy to it: ```json { @@ -38,7 +38,7 @@ For each account where you're not going to deploy the tool (so for all but accou } ``` -If you only have one account, or if you have multiple accounts in the account1, create a new role. Name the role "reservedinstances", select the option "Amazon EC2" in the "AWS Service Roles" list. Create the rol and then attach two policies to it, the previous and and this one: +If you only have one account, or if you have multiple accounts in the account1, create a new role. Name the role "reservedinstances", select the option "Amazon EC2" in the "AWS Service Roles" list. Create the role and then attach two policies to it, the previous and this one: ```json { @@ -122,7 +122,7 @@ If you only have one account, or if you have multiple accounts in the account1, } ``` -You can add as many accouts as you need to the policy. You can use all your linked accounts or a subset of them. +You can add as many accounts as you need to the policy. You can use all your linked accounts or a subset of them. You also need: @@ -130,7 +130,7 @@ You also need: * 2 Subnets * 1 KeyPair * 1 SSL Cert ARN (http://docs.aws.amazon.com/IAM/latest/UserGuide/ManagingServerCerts.html) -* 1 Rails Secret Key (You can generate it in any computer with Ruby installed, just run: +* 1 Rails Secret Key - You can generate it in any computer with Ruby installed, just run: * $ irb * >> require 'securerandom' * >> SecureRandom.hex(64) @@ -144,7 +144,7 @@ Then you should go to the console in the account1, and select the service CloudF If you have any instance of these types: "Windows with SQL Standard", "Windows with SQL Web", "Windows with SQL Enterprise", "RHEL" and "SLES", please continue reading this section and configure the system to read your DBR files. -In first place you should configure the DBR (Detailed Billing Record) file generation following this instructions: http://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/detailed-billing-reports.html#turnonreports (selecting at least the "Detailed billing report with resources and tags" option). +In first place you should configure the DBR (Detailed Billing Record) file generation following these instructions: http://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/detailed-billing-reports.html#turnonreports (selecting at least the "Detailed billing report with resources and tags" option). Add a new policy to the account1 role "reservedinstances" changing the bucket name for the bucket configured to store the DBR: @@ -181,12 +181,12 @@ Finally, you should configure the bucket name in the application in the Setup ta Wait two hours after the action to let the system process the first DBR file. ## Usage -You can access the tool using the URL you can find in the output of the Stack. You should use the default password you put in the parameters of the Stack (you can left the username blank). +You can access the tool using the URL you can find in the output of the Stack. You should use the default password you put in the parameters of the Stack (you can leave the username blank). Once in the tool you should configure it: * Regions in use: Select all the regions you're using in all your accounts. You can select all the regions, but you can filter out the regions you're not using to improve the performance of the tool -* Automatically apply recommendations each: If you introduce 0, then there is not going to be any automatic mofification of the RIs. If you introduce any other number (more than 30), each that number of minutes the application is going to apply all the recommendations automatically +* Automatically apply recommendations each: If you set this to 0, then there is not going to be any automatic mofification of the RIs. If you set this to any other number (more than 30), the application is going to apply all the recommendations automatically periodically on that interval. * Change Password: You can introduce a new password for the tool In the tool there are several options: @@ -194,9 +194,9 @@ In the tool there are several options: * Instances: You can see all your running instances in all the accounts, you can search by any field * Reserved Instances: You can see all your reserved instances in all the accounts * Summary: You can see a summary of your instances and reserved instances. You can see where you have more instances than reserved instances (yellow), and where you have more RIs than instances (red) -* Recommendations: You can see all the recommended modificaions in your RIs, you can select all the modifications of a subset of them and apply the modifications to your RIs from the tool +* Recommendations: You can see all the recommended modifications in your RIs, you can select all the modifications or a subset of them and apply the modifications to your RIs from the tool * Log: You'll see all the recommended modifications to your RIs applied by the tool, in the Recommendations option, or automatically by the periodic task -* Clear Cache: The tool create a cache of 20 minutes of all the API calls, if you want to get the last data then you can clear the cache and then select any other option +* Clear Cache: The tool create a cache of 20 minutes of all the API calls, if you want to get the latest data then you can clear the cache and then select any other option diff --git a/lib/aws_common.rb b/lib/aws_common.rb index 1a6045f..991f304 100644 --- a/lib/aws_common.rb +++ b/lib/aws_common.rb @@ -77,7 +77,7 @@ def get_instances(regions, account_ids) platform = instance.platform.blank? ? "Linux/UNIX" : "Windows" platform = PLATFORMS[amis[instance.image_id]] if !amis[instance.image_id].nil? && !PLATFORMS[amis[instance.image_id]].nil? - instances[instance.id] = {type: instance.instance_type, az: instance.placement.availability_zone, tenancy: instance.placement.tenancy, platform: platform, account_id: account_id[0], vpc: instance.vpc_id.blank? ? "EC2 Classic" : "VPC", ami: instance.image_id} if instance.state.name == 'running' + instances[instance.id] = {type: instance.instance_type, az: instance.placement.availability_zone, tenancy: instance.placement.tenancy, platform: platform, account_id: account_id[0], vpc: instance.vpc_id.blank? ? "EC2 Classic" : "VPC", ami: instance.image_id} if instance.state.name == 'running' and instance.instance_lifecycle != 'spot' end end end