boto3

finding s3 bucket's level 1 prefix sizes while including versions using boto3 and python

最后都变了- 提交于 2020-12-15 05:04:35
问题 I'm an aws python newbie and trying to account for total bucket size shown via metrics tab on UI vs calculating sizes one folder at a time in a give bucket. I tried to fetch it by setting an inventory configuration but it doesn't show what I'm looking for. I have an s3 bucket names my_bucket with versioning enabled. It has 100 Objects and 26 subfolders (will 100000+ objects in each subfolder and atleast two versions for each of the object) WHAT I AM TRYING TO DO: Calculate and display total

finding s3 bucket's level 1 prefix sizes while including versions using boto3 and python

故事扮演 提交于 2020-12-15 05:04:07
问题 I'm an aws python newbie and trying to account for total bucket size shown via metrics tab on UI vs calculating sizes one folder at a time in a give bucket. I tried to fetch it by setting an inventory configuration but it doesn't show what I'm looking for. I have an s3 bucket names my_bucket with versioning enabled. It has 100 Objects and 26 subfolders (will 100000+ objects in each subfolder and atleast two versions for each of the object) WHAT I AM TRYING TO DO: Calculate and display total

dynamodb: how to increment a value in map

点点圈 提交于 2020-12-14 12:39:28
问题 I am trying to use dynamodb to maintain a map of names with their values eg. {"scores": {"player-a": 10}} I also wish to use increment operator to perform atomic increments. However, i could find very little documentation on how to use/update dynamodb maps. Here's the python code I have so far import boto3 ddb = boto3.client('dynamodb') ddb.update_item(TableName='ledger', Key={'week': {'S': '06-12'}}, UpdateExpression='SET scores.player-a = scores.player-a + :val', ExpressionAttributeValues={

dynamodb: how to increment a value in map

痞子三分冷 提交于 2020-12-14 12:33:26
问题 I am trying to use dynamodb to maintain a map of names with their values eg. {"scores": {"player-a": 10}} I also wish to use increment operator to perform atomic increments. However, i could find very little documentation on how to use/update dynamodb maps. Here's the python code I have so far import boto3 ddb = boto3.client('dynamodb') ddb.update_item(TableName='ledger', Key={'week': {'S': '06-12'}}, UpdateExpression='SET scores.player-a = scores.player-a + :val', ExpressionAttributeValues={

Can I resume a download from aws s3?

戏子无情 提交于 2020-12-13 06:31:08
问题 I am using the python boto3 library to download files from s3 to an IOT device on a cellular connection which is often slow and shaky. Some files are quite large (250Mb, which for this scenario is large) and the network fails and the device reboots while downloading. I would like to resume the download from the place it ended when the device rebooted. Is there any way to do it? The aborted download does seem to keep downloaded data in a temporary file while downloading so the data is there.

Can I resume a download from aws s3?

最后都变了- 提交于 2020-12-13 06:31:05
问题 I am using the python boto3 library to download files from s3 to an IOT device on a cellular connection which is often slow and shaky. Some files are quite large (250Mb, which for this scenario is large) and the network fails and the device reboots while downloading. I would like to resume the download from the place it ended when the device rebooted. Is there any way to do it? The aborted download does seem to keep downloaded data in a temporary file while downloading so the data is there.

Need to release all those elastic IP that are unassociated using boto3 in All regions

爷,独闯天下 提交于 2020-12-13 05:45:23
问题 I am using boto3 along with lamda to release the unused elastic IPs. Here I need to release all those IPs present in all regions of My AWS account. def elastic_ips_cleanup(): client = boto3.client('ec2') addresses_dict = client.describe_addresses() for eip_dict in addresses_dict['Addresses']: if "InstanceId" not in eip_dict: print (eip_dict['PublicIp'] + " doesn't have any instances associated, releasing") client.release_address(AllocationId=eip_dict['AllocationId']) I used the above codes

botocore.exceptions.SSLError: SSL validation failed on WIndows

▼魔方 西西 提交于 2020-12-13 04:23:59
问题 The below code is for getting the regions. import boto3 ec2 = boto3.client('ec2', 'region-name') print(ec2.describe_regions()) On executing this code on my machine, I'm getting this error. botocore.exceptions.SSLError: SSL validation failed for https://ec2.region-name.amazonaws.com/ [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108) I am running this code on Windows 10 machine with VS code as my editor. I looked for other answers

botocore.exceptions.SSLError: SSL validation failed on WIndows

吃可爱长大的小学妹 提交于 2020-12-13 04:23:06
问题 The below code is for getting the regions. import boto3 ec2 = boto3.client('ec2', 'region-name') print(ec2.describe_regions()) On executing this code on my machine, I'm getting this error. botocore.exceptions.SSLError: SSL validation failed for https://ec2.region-name.amazonaws.com/ [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108) I am running this code on Windows 10 machine with VS code as my editor. I looked for other answers

ERROR sending a SMS with Amazon SNS and Python and boto3

落爺英雄遲暮 提交于 2020-12-13 03:49:36
问题 The documentation suggests to use the script below but I can't seem to figure out why im getting an error message. This what im using so far: sns = boto3.client('sns', region_name='eu-west-1') sns.publish( PhoneNumber='+5521981554856', Message='hi there', MessageAttributes={ 'AWS.SNS.SMS.SenderID': { 'DataType': 'String', 'StringValue': 'MySenderID' } } ) does anyone knows why im getting the error msg below? raise ParamValidationError(report=report.generate_report()) ParamValidationError: