Created
March 10, 2021 10:26
-
-
Save jmorvan/66b1beae106c84cd30c041f9daa80599 to your computer and use it in GitHub Desktop.
Amazon AWS dowload all invoices for selected period
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
//USE TO DOWNLOAD ALL INVOICES DISPLAYED ON SCREEN IN THE AWS CONSOLE BILLING SECTION | |
let jQ = window.jQuery | |
let downloadLink = invoiceName => `https://console.aws.amazon.com/billing/rest/v1.0/bill/invoice/download?invoicenumber=${invoiceName}&invoiceGroupId=${invoiceName}` | |
let downloadURL = function downloadURL(url, id){ | |
const hiddenIFrameID = 'hiddenDownloader' + id | |
const iframe = document.createElement('iframe') | |
iframe.id = hiddenIFrameID | |
iframe.style.display = 'none' | |
document.body.appendChild(iframe) | |
iframe.src = url | |
} | |
function dlInvoices(){ | |
let entries = jQ('.col1 a'); | |
entries.each((i,y)=> { | |
downloadURL(downloadLink(y.text.trim()), i) | |
}); | |
} | |
jQ('.payment-history-section div.right').prepend('<a href="javascript:dlInvoices()">DOWNLOAD ALL DISPLAYED INVOICES</a>') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment