账单脚本

main
lzCodeGarden 11 months ago
parent 12308b0e8f
commit b3717e638c

@ -249,6 +249,15 @@ aws_aksk = {
"role_arn": "",
"external_id": ""
},
"087353436373":{
"account_type": "1",
"aws_access_key_id": "AKIA4FU4JFDXO5J2ISNY",
"aws_secret_access_key": "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",
"bucket": "087353436373billing",
"credential_type": "Amazon Access Key",
"role_arn": "",
"external_id": "l2c-bijnnyaf"
},
"690337281734":{
"account_type": "amazon-china",
"aws_access_key_id": "AKIAQWIJ3GB7CTO5GAWY",
@ -262,16 +271,16 @@ aws_aksk = {
def getFiles(payer_id):
credential = get_credentials(payer_id)
bucket = credential.pop('bucket')
s3 = boto3.resource('s3' , **credential)
bucket = s3.Bucket('435857483079bliing')
bucket = s3.Bucket('087353436373billing')
objetss=bucket.objects.limit(10000);
for key in objetss:
print(key.key)
def getBucket(payer_id):
credential = get_credentials(payer_id)
bucket = credential.pop('bucket')
credential['region_name']='cn-north-1'
del credential['bucket']
s3 = boto3.resource('s3' , **credential)
bucket = list(s3.buckets.all())
for key in bucket:
@ -367,9 +376,9 @@ if __name__ == '__main__':
# '028328046529-aws-billing-detailed-line-items-with-resources-and-tags-ACTS-Ningxia-2024-01.csv.zip',
)
# getBucket('435857483079')
# getFiles('435857483079')
auto_download_file_form_s3(filenames)
getBucket('087353436373')
getFiles('087353436373')
# auto_download_file_form_s3(filenames)
#
# getBucket('028328046529')
# getFiles('435857483079')

@ -264,7 +264,7 @@ def getFiles(payer_id):
credential = get_credentials(payer_id)
bucket = credential.pop('bucket')
s3 = boto3.resource('s3' , **credential)
bucket = s3.Bucket('435857483079bliing')
bucket = s3.Bucket('087353436373billing')
objetss=bucket.objects.limit(10000);
for key in objetss:
@ -362,10 +362,10 @@ if __name__ == '__main__':
# '047802167422-aws-cost-allocation-ACTS-Ningxia-2023-09.csv',
# '047802167422-aws-cost-allocation-2023-09.csv'
'435857483079-aws-cost-allocation-ACTS-2024-03.csv'
'435857483079-aws-cost-allocation-ACTS-Ningxia-2024-03.csv',
'435857483079-aws-cost-allocation-2024-03.csv',
'435857483079-aws-cost-allocation-AWSMarketplace-2024-03.csv',
'087353436373-aws-cost-allocation-ACTS-2024-06.csv'
'087353436373-aws-cost-allocation-ACTS-Ningxia-2024-03.csv',
'087353436373-aws-cost-allocation-2024-03.csv',
'087353436373-aws-cost-allocation-AWSMarketplace-2024-03.csv',
# 施耐德
# '028328046529-aws-billing-detailed-line-items-with-resources-and-tags-ACTS-2022-08.csv.zip',
# '028328046529-aws-billing-detailed-line-items-with-resources-and-tags-ACTS-Ningxia-2023-04.csv.zip',
@ -383,4 +383,4 @@ if __name__ == '__main__':
# auto_download_file_form_s3(filenames)
#
# getBucket('028328046529')
getFiles('435857483079')
getFiles('087353436373')

@ -285,7 +285,7 @@ def get_credentials(payer_id):
if __name__ == '__main__':
date = '2024-05'
date = '2024-06'
filenames = (
#嘉实
'087353436373-aws-billing-detailed-line-items-with-resources-and-tags-ACTS-'+date+'.csv.zip',

@ -25,7 +25,7 @@ import java.util.stream.Collectors;
*/
public class Main {
static String date="2024-05";
static String date="2024-06";
/**
*

Binary file not shown.

@ -915,7 +915,7 @@ class GenerateWordFromCSV(GenerateWord):
if __name__ == '__main__':
# 获取输入执行时输入参数
month = '2024-05'
month = '2024-06'
if len(sys.argv) > 1:
month = sys.argv[1]
print('执行月份:' + month)

@ -771,7 +771,7 @@ class Custom_Ningxia_Excel(Custom_Excel):
if __name__ == '__main__':
# 获取输入执行时输入参数
month = '2024-05'
month = '2024-06'
if len(sys.argv) > 1:
month = sys.argv[1]
print('执行月份:' + month)

@ -799,7 +799,7 @@ class SamsungGenerateWordFromCSV(GenerateWordFromCSV):
if __name__ == '__main__':
# 获取输入执行时输入参数
month = '2024-05'
month = '2024-06'
if len(sys.argv) > 1:
month = sys.argv[1]
print('执行月份:' + month)

@ -1,24 +0,0 @@
"LinkedAccountId","ProductName","CostBeforeTax"
"089027636324","Amazon Data Transfer","4.576e-05"
"089027636324","Amazon Simple Storage Service","0.02480192"
"089027636324","AmazonCloudWatch","0.0"
"495611708767","Amazon CloudTrail","0.0"
"495611708767","Amazon Data Transfer","10.74701368"
"495611708767","Amazon Direct Connect","150.62606208000003"
"495611708767","Amazon Elastic Compute Cloud","229.66590504"
"495611708767","Amazon Lambda","0.0"
"495611708767","Amazon Simple Notification Service","0.0"
"495611708767","Amazon Simple Storage Service","0.07181928"
"495611708767","Amazon Virtual Private Cloud","153.20448000000002"
"495611708767","AmazonCloudWatch","0.5216744"
"495611708767","Elastic Load Balancing","244.54808247999998"
"495813331767","Amazon CloudTrail","0.0"
"495813331767","Amazon Data Transfer","0.23148111999999998"
"495813331767","Amazon Direct Connect","0.006236879999999999"
"495813331767","Amazon Elastic Compute Cloud","242.45311791999998"
"495813331767","Amazon Lambda","0.0"
"495813331767","Amazon Simple Notification Service","0.0"
"495813331767","Amazon Simple Storage Service","0.06702280000000001"
"495813331767","Amazon Virtual Private Cloud","153.20448000000002"
"495813331767","AmazonCloudWatch","0.12520247999999998"
"495813331767","Elastic Load Balancing","241.84812391999998"
1 LinkedAccountId ProductName CostBeforeTax
2 089027636324 Amazon Data Transfer 4.576e-05
3 089027636324 Amazon Simple Storage Service 0.02480192
4 089027636324 AmazonCloudWatch 0.0
5 495611708767 Amazon CloudTrail 0.0
6 495611708767 Amazon Data Transfer 10.74701368
7 495611708767 Amazon Direct Connect 150.62606208000003
8 495611708767 Amazon Elastic Compute Cloud 229.66590504
9 495611708767 Amazon Lambda 0.0
10 495611708767 Amazon Simple Notification Service 0.0
11 495611708767 Amazon Simple Storage Service 0.07181928
12 495611708767 Amazon Virtual Private Cloud 153.20448000000002
13 495611708767 AmazonCloudWatch 0.5216744
14 495611708767 Elastic Load Balancing 244.54808247999998
15 495813331767 Amazon CloudTrail 0.0
16 495813331767 Amazon Data Transfer 0.23148111999999998
17 495813331767 Amazon Direct Connect 0.006236879999999999
18 495813331767 Amazon Elastic Compute Cloud 242.45311791999998
19 495813331767 Amazon Lambda 0.0
20 495813331767 Amazon Simple Notification Service 0.0
21 495813331767 Amazon Simple Storage Service 0.06702280000000001
22 495813331767 Amazon Virtual Private Cloud 153.20448000000002
23 495813331767 AmazonCloudWatch 0.12520247999999998
24 495813331767 Elastic Load Balancing 241.84812391999998

@ -408,7 +408,7 @@ class Custom_Excel(object):
if __name__ == '__main__':
# 获取输入执行时输入参数
month = '2024-05'
month = '2024-06'
if len(sys.argv) > 1:
month = sys.argv[1]
print('执行月份:' + month)

@ -632,7 +632,7 @@ def check_path_creat(path):
if __name__ == '__main__':
#获取输入执行时输入参数
month='2024-05'
month='2024-06'
if len(sys.argv) > 1:
month = sys.argv[1]
print('执行月份:'+month)

@ -490,7 +490,7 @@ class Custom_Excel(object):
if __name__ == '__main__':
# 获取输入执行时输入参数
month = '2024-05'
month = '2024-06'
if len(sys.argv) > 1:
month = sys.argv[1]
print('执行月份:' + month)

Loading…
Cancel
Save