Of course static only refers to the web pages delivered. Those pages can still post form content to another S3 bucket also configured as a website.
The things that tripped me up were:-
a) Don't use the endpoint listed in the AWS console. Modify it to take out the region.
b) Specify an acl with the post. Otherwise even the bucket owner cannot download the content.
c) I have to keep setting read access for everyone every time I re-upload a file to the main site.
E.g. the posting form looks like:-
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<form action="http://mysitenameuploads.s3.amazonaws.com/" method="post"
enctype="multipart/form-data">
Your name (any unique key): <input type="text" name="key" size="80" value="anonuser"/><br/>
Acl: <input type="text" name="acl" size="80" value="bucket-owner-full-control"/><br/>
Content: <input type="text" name="file" size="80" value="{ "body": "some json content"}"><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
To read the posted data I am intending to turn on notifications for the uploads bucket and trigger AWS lamda code. Or I can download it later at leisure if there is no urgency in processing.
I have now implemented lambda functions triggered by s3 events (just empty with a log). The java one is terribly slow on first start and memory hungry.
REPORT RequestId: 97ad2da1-a835-11e5-9f10-271cbd9814df Duration: 2989.61 ms Billed Duration: 3000 ms Memory Size: 128 MB Max Memory Used: 79 MB
The java one speeds up on subsequent requests to 2 ms (but still billed 100ms)
REPORT RequestId: cab829d5-a838-11e5-aa1b-c3dbfd807f5b Duration: 2.00 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 79 MB
So it looks as though I have a VM which gets swapped out when demand falls.
The python one is 1/2 the memory but still slower than I would like.
REPORT RequestId: f3b13d82-a82a-11e5-ba7f-c530ef1c7bd5 Duration: 197.21 ms Billed Duration: 200 ms Memory Size: 128 MB Max Memory Used: 43 MB
I have now implemented lambda functions triggered by s3 events (just empty with a log). The java one is terribly slow on first start and memory hungry.
REPORT RequestId: 97ad2da1-a835-11e5-9f10-271cbd9814df Duration: 2989.61 ms Billed Duration: 3000 ms Memory Size: 128 MB Max Memory Used: 79 MB
The java one speeds up on subsequent requests to 2 ms (but still billed 100ms)
REPORT RequestId: cab829d5-a838-11e5-aa1b-c3dbfd807f5b Duration: 2.00 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 79 MB
So it looks as though I have a VM which gets swapped out when demand falls.
The python one is 1/2 the memory but still slower than I would like.
REPORT RequestId: f3b13d82-a82a-11e5-ba7f-c530ef1c7bd5 Duration: 197.21 ms Billed Duration: 200 ms Memory Size: 128 MB Max Memory Used: 43 MB
It also speeds up on repeated requests.
REPORT RequestId: 09325b69-a83b-11e5-82a2-51b3cc5c7850 Duration: 16.32 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 21 MB
The node version is the fastest and smallest. Worst case it has
REPORT RequestId: 17338845-a83e-11e5-9113-136c07ee4a8a Duration: 14.19 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 18 MB
After warmup it has
REPORT RequestId: 1eae0dc1-a83e-11e5-97a0-db389f3e9f5e Duration: 0.47 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 18 MB
So recommend node for implementation and try to do as much work per call as possible since you are billed 100ms anyway.
As Nginx and c++ can have very low memory footprint, maybe I should be using that and fastcgi.
REPORT RequestId: 09325b69-a83b-11e5-82a2-51b3cc5c7850 Duration: 16.32 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 21 MB
The node version is the fastest and smallest. Worst case it has
REPORT RequestId: 17338845-a83e-11e5-9113-136c07ee4a8a Duration: 14.19 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 18 MB
After warmup it has
REPORT RequestId: 1eae0dc1-a83e-11e5-97a0-db389f3e9f5e Duration: 0.47 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 18 MB
So recommend node for implementation and try to do as much work per call as possible since you are billed 100ms anyway.
As Nginx and c++ can have very low memory footprint, maybe I should be using that and fastcgi.
No comments:
Post a Comment