AWS Elastic Beanstalk, running a cronjob

This is how I added a cron job to Elastic Beanstalk: Create a folder at the root of your application called .ebextensions if it doesn’t exist already. Then create a config file inside the .ebextensions folder. I’ll use example.config for illustration purposes. Then add this to example.config container_commands: 01_some_cron_job: command: “cat .ebextensions/some_cron_job.txt > /etc/cron.d/some_cron_job && … Read more

CloudFront + S3 Website: “The specified key does not exist” when an implicit index document should be displayed

I’ll go out on a limb and say that the specified key doesn’t technically exist, so the error message is technically accurate but doesn’t tell the whole story. This should be an easy fix. S3 buckets have two¹ endpoints, “REST” and “website.” They have two different feature sets. The web site endpoint provides magical resolution … Read more

How to pass a querystring or route parameter to AWS Lambda from Amazon API Gateway

As of September 2017, you no longer have to configure mappings to access the request body. All you need to do is check, “Use Lambda Proxy integration”, under Integration Request, under the resource. You’ll then be able to access query parameters, path parameters and headers like so event[‘pathParameters’][‘param1’] event[“queryStringParameters”][‘queryparam1’] event[‘requestContext’][‘identity’][‘userAgent’] event[‘requestContext’][‘identity’][‘sourceIP’]

S3 Static Website Hosting Route All Paths to Index.html

It’s very easy to solve it without url hacks, with CloudFront help. Create S3 bucket, for example: react Create CloudFront distributions with these settings: Default Root Object: index.html Origin Domain Name: S3 bucket domain, for example: react.s3.amazonaws.com Go to Error Pages tab, click on Create Custom Error Response: HTTP Error Code: 403: Forbidden (404: Not … Read more

Amazon CloudFront Latency

CloudFront attempts to fetch uncached content from the origin server in real time. There is no “replication delay” or similar issue because CloudFront is a pull-through CDN. Each CloudFront edge location knows only about your site’s existence and configuration; it doesn’t know about your content until it receives requests for it. When that happens, the … Read more

Increasing client_max_body_size in Nginx conf on AWS Elastic Beanstalk

There are two methods you can take for this. Unfortunately some work for some EB application types and some work for others. Supported/recommended in AWS documentation For some application types, like Java SE, Go, Node.js, and maybe Ruby (it’s not documented for Ruby, but all the other Nginx platforms seem to support this), Elasticbeanstalk has … Read more