Integrate vRealize Business 7.1 with AWS India Accounts and PowerShell Scripts.
I was going through a use case to integrate vRealize Business 7.1 with AWS accounts created based out of India, and noticed that eventhough all the necessary permissions to setup AWS for vRB integration was done, it still failed with the below error.
After reading through the official document i found that this integration failed due to the mismatch in the billing format getting generated for AWS accounts based out of India Region as it had a tag -AISPL- in it and vRB expects it as
“123456789012-aws-billing-detailed-line-items-with-resources-and-tags-yyyy-mm.csv.zip”
But if you head over to your S3 bucket you would see that there is an additional tag named AISPL which gets appended to the zip files.
And due to this, vRB is unable to read it.
After raising a case with AWS they said that AISPL tag gets associated for all accounts created based out of India location and the only alternative is to create a new account based out of US region.
Amazon Internet Services Private Limited (AISPL) is a local legal Indian entity that acts as a reseller for AWS services in India. AISPL customers can utilize AWS services and regions like other AWS Inc. customers. By signing an agreement with AISPL, customers will receive benefits like the ability to pay in Indian Rupees (INR), the elimination of foreign transaction fees charged by banks and credit cards, and reduced withholding tax rates, if applicable. All of our customers in India who sign up for new AWS accounts will sign agreements with and automatically utilize AISPL.
There are no additional steps you need to take to sign up for an AISPL account– simply sign up for a new account and specify your country as India. Once you have completed your signup, you will be ready to use AISPL. Because you’re actually purchasing your AWS Services from AISPL, we’re unable to remove AISPL from your billing information since the purchase contract exists between yourself and AISPL.
At this time we are unable to transfer your existing AISPL account to AWS; however, you can utilize AWS immediately by simply creating a new account and specifying a country other than India while signing up.
Now, this is not feasible for a customer who has a full fledged app stack deployment in AWS and wants to integrate with vRealize Business.
Now as an alternative to fix this issue till the code fix happens in the vRealize Business product, i created a Powershell Script based on the AWS cmdlets which can run as a scheduled task once a day which downloads all the zip files from the S3 bucket with the AISPL format, unzips them, renames them to the vRB 7.1 recognised format which is the same file without the AISPL tag, zips it back again and upload the files back to the S3 bucket, so that, next time vRB initiates a sync with the AWS bill zip files it gives us a successful sync status.
# Retrieve the Zip files and save the files locally on your server Get-S3Object -BucketName india -Region ap-southeast-1 | ?{$_.key -match "994693050884-aws-billing-detailed-line-items-with-resources-and-tags-AISPL"} | % {Copy-S3Object -BucketName india -Region ap-southeast-1 -Key $_.key -LocalFile C:\Users\vinithm\Downloads\aws\$($_.key)} # Expand the Zip files to get the csv files inside them. Get-childItem C:\Users\vinithm\Downloads\aws\ | % {Expand-Archive -Path C:\Users\vinithm\Downloads\aws\$($_.name) -DestinationPath C:\Users\vinithm\Downloads\aws -Force} # Remove the unwanted zip files Remove-Item C:\Users\vinithm\Downloads\aws\*.zip # Rename all the csv files by removing AISPL in them Get-childItem C:\Users\vinithm\Downloads\aws\ | rename-item -newname { $_.name -replace '-AISPL','' } # Again compress the zip files Get-childItem C:\Users\vinithm\Downloads\aws\ | % {Compress-Archive $_.fullname -DestinationPath C:\Users\vinithm\Downloads\aws\$($_.name).zip } # Upload the zip files agai back to S3 bucket Get-childItem C:\Users\vinithm\Downloads\aws\*.zip | ?{$_.name -notmatch "AISPL"} | % {Write-S3Object -BucketName india -Region ap-southeast-1 -Key $_.name -File $_.fullname } # Remove all local files on your server. Remove-Item C:\Users\vinithm\Downloads\aws\*.*
Now, if you hit a refresh in your vRealize Business 7.1 instance you will see that the AWS data gets populated.
Another View from the status bar.
I hope you enjoyed this bblog post and found this useful for vRealize Business integration with AWS.