I am trying the new AWS Elastic Beanstalk console ui. I am having a problem now to set up virtual paths on ui.
Basically I put all my static files, including index.html in a folder ui
inside my bundle.
This is the bundle structure:
/ui
/ui/favicon.ico
/ui/index.html
/ui/static
/ui/static/css/...
/ui/static/js/...
/ui/static/media/...
package.json
yarn.lock
app.js // this is the node api and it works
The API works when access my [http://public]/api/alive. My intention is set virtual directories to serve static files from bundle folder ui.
The node api sends down the index.html
when it doesn't match anything. This works: [http://public]/. I get the index.html
.
Then the browser requests static files /static/js/main[hash].js
. This works but the problem is I can't even set up any virtual path to play around. I need to map the browser request /static
to /ui/static
at AWS.
elasticbeanstalk error:
/static/: Invalid option specification (Namespace: 'aws:elasticbeanstalk:container:python:staticfiles', OptionName: '/static/'): Unknown configuration setting. static/: Invalid option specification (Namespace: 'aws:elasticbeanstalk:container:python:staticfiles', OptionName: 'static/'): Unknown configuration setting. /assets: Invalid option specification (Namespace: 'aws:elasticbeanstalk:container:python:staticfiles', OptionName: '/assets'): Unknown configuration setting. static: Invalid option specification (Namespace: 'aws:elasticbeanstalk:container:python:staticfiles', OptionName: 'static'): Unknown configuration setting.
No matter where I put the slashes, it wont work:
All the paths I specified exist inside my deployed app bundle, apart from /static/assets
which is just to try anything different.
I am not sure if this is a bug on the new UI or not. If anyone had the same problem please let me know.
Sign in to the AWS Management Console and open the Route 53 console at https://console.aws.amazon.com/route53/ . In the navigation pane, choose Hosted zones. Choose the name of the hosted zone that you want to use to route traffic to your Elastic Beanstalk environment. Choose Create record.
Elastic Beanstalk isn't great if you need a lot of environment variables. The simple reason is that Elastic Beanstalk has a hard limit of 4KB to store all key-value pairs. The environment had accumulated 74 environment variables — a few of them had exceedingly verbose names.
I found this question while trying to serve static content from a Python 3.7 Django application using Amazon Linux 2; however, I think the answer will be the same for different platforms.
Reading the documentation here I found this link: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/environment-cfg-staticfiles.html
which indicated a .config
sample file like this
Example .ebextensions/static-files.config
option_settings:
aws:elasticbeanstalk:environment:proxy:staticfiles:
/html: statichtml <-- path/to/your/static/dir/ (added by Nick)
/images: staticimages
so, it looks like the namespace changed from aws:elasticbeanstalk:container:python:staticfiles
to aws:elasticbeanstalk:environment:proxy:staticfiles
. This seems to be a more generic reverse proxy to be platform agnostic which makes sense. Good job AWS.
When I tried this, amazingly the documentation was up to date and it worked.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With