amazon-web-services

Add Dynamic Content Disposition for file names(amazon S3) in python

走远了吗. 提交于 2021-02-07 20:26:13
问题 I have a Django model that saves filename as "uuid4().pdf". Where uuid4 generates a random uuid for each instance created. This file name is also stored on the amazon s3 server with the same name. I am trying to add a custom disposition for filename that i upload to amazon s3, this is because i want to see a custom name whenever i download the file not the uuid one. At the same time, i want the files to stored on s3 with the uuid filename. So, I am using django-storages with python 2.7. I

How to use Serializer and Deserializer in Sagemaker 2

痴心易碎 提交于 2021-02-07 20:20:51
问题 I spin up a Sagemaker notebook using the conda_python3 kernel, and follow the example Notebook for Random Cut Forest. As of this writing, the Sagemaker SDK that comes with conda_python3 is version 1.72.0, but I want to use new features, so I update my notebook to use the latest %%bash pip install -U sagemaker And I see it updates. print(sagemaker.__version__) # 2.4.1 A change from version 1.x to 2.x was the serializer/deserializer classes Previously (in version 1.72.0) I'd update my predictor

Imported SSL Cert not listed for ALB Listener

人走茶凉 提交于 2021-02-07 20:01:25
问题 I have created an SSL cert via DigiCert and imported to ACM. (I require the same SSL to be applied to both ALB and the Application, and since there's no way to import ACM certs, I had to follow this way) I have successfully imported the SSL and can see it in the console. However, I cannot apply it to ALB 443 Listener. I provided the Cert ARN to the CloudFormation template and it fails stating certificate don't exist. I have tried to manually update the 443 Listener, but the cert is not listed

Bulk Generate Pre-Signed URLs boto3

百般思念 提交于 2021-02-07 19:51:00
问题 I am currently using the following to create a pre-signed url for a bucket resource: bucket_name = ... key = ... s3_client = ... s3_client.generate_presigned_url( ClientMethod="get_object", Params={ "Bucket": bucket_name, "Key": key }, ExpiresIn=100 ) This works fine. However, I was wondering if it was possible to generate pre-signed urls for multiple keys in one request? Or is it required to make one request for each key? I didn't find anything useful in the docs regarding this topic. I'm

Python AWS Lambda Certificates

允我心安 提交于 2021-02-07 19:49:43
问题 How do I add an additional CA (certificate authority) to the trust store used by my Python3 AWS Lambda function? 回答1: If you only need a single CA, then get your crt file and encode it into a pem using the following command in linux: openssl x509 -text -in "{your CA}.crt" > cacert.pem If you need to add CA's to the default CA bundle, then copy python3.8/site-packages/certifi/cacert.pem to your lambda folder. Then run this command for each crt: openssl x509 -text -in "{your CA}.crt" >> cacert

Python AWS Lambda Certificates

五迷三道 提交于 2021-02-07 19:48:20
问题 How do I add an additional CA (certificate authority) to the trust store used by my Python3 AWS Lambda function? 回答1: If you only need a single CA, then get your crt file and encode it into a pem using the following command in linux: openssl x509 -text -in "{your CA}.crt" > cacert.pem If you need to add CA's to the default CA bundle, then copy python3.8/site-packages/certifi/cacert.pem to your lambda folder. Then run this command for each crt: openssl x509 -text -in "{your CA}.crt" >> cacert

Python AWS Lambda Certificates

丶灬走出姿态 提交于 2021-02-07 19:48:17
问题 How do I add an additional CA (certificate authority) to the trust store used by my Python3 AWS Lambda function? 回答1: If you only need a single CA, then get your crt file and encode it into a pem using the following command in linux: openssl x509 -text -in "{your CA}.crt" > cacert.pem If you need to add CA's to the default CA bundle, then copy python3.8/site-packages/certifi/cacert.pem to your lambda folder. Then run this command for each crt: openssl x509 -text -in "{your CA}.crt" >> cacert

Does lambda persist any data in memory?

社会主义新天地 提交于 2021-02-07 19:42:12
问题 I have below code in AWS lambda: const cache = {}; exports.handler = async (event) => { // TODO implement if (cache[event.key]) { console.log('read from cache'); return cache[event.key]; } console.log('generate value'); cache[event.key] = Math.random() return cache[event.key]; }; when I run the the lambda and I can see read from cache on the log which means the lambda cache some values in cache memory. Does the lambda persist its memory when it becomes warm? Does it mean I can make use of

boto3 Get a resource from a client

六月ゝ 毕业季﹏ 提交于 2021-02-07 19:06:26
问题 The AWS Library for python (boto) has two different types of interfaces for working with AWS, a low level client and a higher level more pythonic resource . Parts of my code use one, while other parts use the other. Getting a client from a resource is found from the docs. # Create the resource sqs_resource = boto3.resource('sqs') # Get the client from the resource sqs = sqs_resource.meta.client My questions is if have the client sqs , how do I get a boto3.resource from this? (I can't simply

boto3 Get a resource from a client

删除回忆录丶 提交于 2021-02-07 19:02:12
问题 The AWS Library for python (boto) has two different types of interfaces for working with AWS, a low level client and a higher level more pythonic resource . Parts of my code use one, while other parts use the other. Getting a client from a resource is found from the docs. # Create the resource sqs_resource = boto3.resource('sqs') # Get the client from the resource sqs = sqs_resource.meta.client My questions is if have the client sqs , how do I get a boto3.resource from this? (I can't simply