Configure programmatic billing in cloud providers
...
Amazon
See the AWS documentation about how to configure programmatic billing for AWS EC2 - https://aws.amazon.com/blogs/aws/new-programmatic-access-to-aws-billing-data/
- Create an S3 bucket and assign the following policy to make it writable by AWS programmatic billing.
The "Resource" attribute will need the bucket name at the end. For the example, we have used "programmaticbilling". note down the name. AWS will write the programmatic billing data to this bucketExpand Assign the following policy to the S3 bucket. In this example, the bucket is called "programmaticbilling". Replace "programmaticbilling" with the name of your bucket
Code Block { "Version": "2008-10-17", "Id": "Policy1335892530063", "Statement": [ { "Sid": "Stmt1335892150622", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::386209384616:root" }, "Action": [ "s3:GetBucketAcl", "s3:GetBucketPolicy" ], "Resource": "arn:aws:s3:::programmaticbilling" }, { "Sid": "Stmt1335892526596", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::386209384616:root" }, "Action": "s3:PutObject", "Resource": "arn:aws:s3:::programmaticbilling/*" } ] }
- Go to Open Billing preferences and select the option to "Receive billing reports". Enter the name of your billing bucket
- Create a new user for programmatic billing (the user name is not important) and add you can give it any name - we used "programmaticbilling"!). Assign the AmazonS3ReadOnlyAccess policy to your user
Monthly CSV file
Azure
...
- Grant access to billing records to the app role created in Azure
- Obtain the OfferDurableID from the offer agreement for your enterprise by going to your subscription → Administer.
- Also, you should check obtain the Currency, Locale and RegionInfo.
- In Abiquo, configure Enterprise properties with the name of billing properties
- AWS EC2
- "billing_bucket" property, with a value of the name of the billing bucket you created in step 1
- Azure ARM requires
- OfferDurableID
- Currency, the default is "USD"
- Locale, the default is "en-US"
- RegionInfo, the default is "US"
- AWS EC2
- On a server with MariaDB installed and with access to Abiquo Server, Abiquo database and public cloud providers, install the new billing packages
- abiquo-billing-arm
- abiquo-billing-ec2
- Configure billing packages
- AWS: Edit /opt/abiquo-billing-ec2/config/config.yml
- Abiquo database connection: user must be granted select from this host
- ec2-billing database: can be hosted on localhost
- Abiquo API: user must have Manage bills privilege
Edit the configuration files in config/config.yml - AWS: Edit /opt/abiquo-billing-ec2/config/config.yml
Install and configure billing packages
You will need a server with MariaDB running with access to the Abiquo API, Abiquo database, and public cloud providers.
- Install the billing packages. The package name for Azure is "abiquo-billing-arm" and the package name for Amazon is "abiquo-billing-ec2".
Create the local billing databases and import schemas
AWS:
Code Block mysql -e "create database ec2_billing" mysql -h -p -u ec2_billing < /opt/abiquo-billing-ec2/lib/app/schema.sql
Azure:
Code Block mysql -e "create database arm_billing" mysql -h -p -u arm_billing < /opt/abiquo-billing-arm/lib/app/schema.sql
Grant
permissions onprivileges to a user for the local billing databases
to the user configured in each config.yml- If the Abiquo database is encrypted with a custom seed, copy that seed with each config.yml
- Assign Abiquo user
Configure the billing packages, edit the config.yml file. By default for AWS, this is file is located at /opt/abiquo-billing-ec2/config/config.yml and here is an example:
Code Block abiquo_database: host: 10.10.10.36 user: user password: password port: 3306 billing_database: host: 10.10.10.38 user: user password: password port: 3306 abiquo: api_url: http://10.10.10.32/api user: admin password: xabiquo seed:
Notes:The billing database is the one you created in the above steps, so it can be hosted on localhost
"seed" is the name of a custom seed that encrypts the Abiquo database. Copy the custom seed into the same directory as the config.yml file for each provider
- On the Abiquo database, grant select privileges from this host to the abiquo_database user that will run the bililng scripts
- In Abiquo, check that the Abiquo API user has the Manage bills privilege
- In Abiquo, configure Enterprise properties with the name of billing properties
- AWS EC2
- "billing_bucket" property, with a value of the name of the billing bucket you created in step 1
- Azure ARM requires
- OfferDurableID
- Currency, the default is "USD"
- Locale, the default is "en-US"
- RegionInfo, the default is "US"
- AWS EC2
- Assign Abiquo users the privileges to Display hybrid dashboard tab, View bills, and optionally to Display VM cost view widget (hybrid tab)
...