boto

Django amazon s3 SuspiciousOperation

徘徊边缘 提交于 2020-01-14 09:52:09
问题 So when i try accessing a certain image on S3 from my browser everything works fine. But when python is doing it i get a SuspiciousOperation error. My static folder is public on S3 so i really have no idea where this is coming from. Publication.objects.get(id=4039).cover.url Traceback (most recent call last): File "<console>", line 1, in <module> File "/home/vagrant/.pyenv/versions/blook/lib/python2.7/site-packages/django/db/models/fields/files.py", line 64, in _get_url return self.storage

Django amazon s3 SuspiciousOperation

[亡魂溺海] 提交于 2020-01-14 09:52:05
问题 So when i try accessing a certain image on S3 from my browser everything works fine. But when python is doing it i get a SuspiciousOperation error. My static folder is public on S3 so i really have no idea where this is coming from. Publication.objects.get(id=4039).cover.url Traceback (most recent call last): File "<console>", line 1, in <module> File "/home/vagrant/.pyenv/versions/blook/lib/python2.7/site-packages/django/db/models/fields/files.py", line 64, in _get_url return self.storage

Returning the outputs from a CloudFormation template with Boto?

主宰稳场 提交于 2020-01-13 09:40:10
问题 I'm trying to retrieve the list of outputs from a CloudFormation template using Boto. I see in the docs there's an object named boto.cloudformation.stack.Output . But I think this is unimplemented functionality. Is this currently possible? 回答1: If you do a describe_stacks call, it will return a list of Stack objects and each of those will have an outputs attribute which is a list of Output objects. Is that what you are looking for? 来源: https://stackoverflow.com/questions/14163114/returning

Boto s3 get_metadata

て烟熏妆下的殇ゞ 提交于 2020-01-13 08:04:51
问题 Trying to get meta_data that i have set on all my items in an s3 bucket. Which can be seen in the screenshot and below is the code I'm using. The two get_metadata calls return None. Any idea's boto.Version '2.5.2' amazon_connection = S3Connection(ec2_key, ec2_secret) bucket = amazon_connection.get_bucket('test') for key in bucket.list(): print " Key %s " % (key) print key.get_metadata("company") print key.get_metadata("x-amz-meta-company") 回答1: bucket.list() does not return metadata. try this

Django Storage Backend for S3

风格不统一 提交于 2020-01-11 19:56:22
问题 I'm looking for a good Django custom storage backend for use with Amazon S3. I've been googling around and found a lot of blog posts with code snippets or half-baked gist.github.com one-off jobs. But I can't seem to find a solid, well-tested one. Is there a widely accepted standard Amazon S3 Django custom storage backend out there? It doesn't particularly matter to me what Python backend library it uses--i.e., either S3.py or boto are fine. 回答1: Have you checked out django-storages? I would

AWS的预留实例(ReservedInstances)到期总是忘记怎么办?自己写脚本一样能监控

让人想犯罪 __ 提交于 2020-01-10 10:09:19
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> AWS的 预留实例(ReservedInstances) 是告知服务商,用户在某个周期内要使用ec2的资源的规格。这样就能用相对较低的价格来使用ec2资源。 然而很多时候我们忘记为预留实例延期续费,这样一旦过期,资源将按照使用时长来计费,费用将会增长。 boto3 是aws提供给python开发者的SDK,我们通过boto3可以获取到预留实例的相关信息。 boto3部署按照方法: 可以参照 官方网站https://boto3.amazonaws.com/v1/documentation/api/latest/guide/quickstart.html 。 值得注意的是,因为我们使用zabbix进行监控,所以.aws目录需要在zabbix用户的根目录下创建。 监控脚本: rinViewer.py: import datetime import json import time import sys from pytz import timezone class rinViewer: def __init__(self,botoclient): self.client = botoclient; self.info = self.client.describe_reserved_instances()[

Boto: How do I use the 'tag' parameter of the AutoScalingGroup method?

自古美人都是妖i 提交于 2020-01-05 07:59:46
问题 The following code works. In other words, there is no error returned and a group is created. However, the instances launched by this group will not have a Name tag. AS_GROUP = AutoScalingGroup( group_name=AS_GROUP_NAME, availability_zones=ZONE_LIST, launch_config=LAUNCH_CONFIG_NAME, min_size=GROUP_MIN_SIZE, max_size=GROUP_MAX_SIZE, default_cooldown=DEFAULT_COOLDOWN, desired_capacity=DESIRED_CAPACITY, tag=[Tag( key='Name', value='ASG Minion', propagate_at_launch=True, resource_id=AS_GROUP_NAME

using local endpoint with boto2

对着背影说爱祢 提交于 2020-01-05 04:12:12
问题 I am trying to mock AWS s3 api calls using boto2. I create local s3 endpoint using localstack and can use this using boto3 easily as below, import boto3 s3_client = boto3.client('s3', endpoint_url='http://localhost:4572') bucket_name = 'my-bucket' s3_client.create_bucket(Bucket=bucket_name) But I did not find way to do this using boto2. Is there any way preferably using ~/.boto or ~/.aws/config? Tried providing endpoint with boto2 but it failed. import boto boto.s3.S3RegionInfo(name='test-s3

Trying to Get SQS Message ID with Boto

情到浓时终转凉″ 提交于 2020-01-03 18:35:13
问题 Looking at the boto docs, I don't see a method of fetching the message identifier when you pull it off of an SQS queue. Can anyone provide some information on how I would get this information? 回答1: The Message instance should have an attribute called id which contains the message id. 来源: https://stackoverflow.com/questions/25435856/trying-to-get-sqs-message-id-with-boto

Access Denied error with Amazon S3

↘锁芯ラ 提交于 2020-01-03 11:46:34
问题 I'm getting an Access Denied error with Amazon S3 and can't figure out why. My settings are as follows: STATIC_URL = 'http://s3.amazonaws.com/%s/' % AWS_STORAGE_BUCKET_NAME What would cause an access denied error? I have verified that my keys are correct. 回答1: The URL you show above would resolve to a bucket within S3. In order to access that bucket successfully with such a URL, the permissions on the bucket would have to grant 'public-read' access to the bucket. In addition, each object or