I have a config file in my projects's .ebextensions directory containing
option_settings:
"aws:elasticbeanstalk:container:python:staticfiles":
"/static/": "sitetest/static/"
but my EB environment does not change the setting for /static/ in response to this being pushed to AWS.
I can verify that other config settings in the same directory — e.g. for environment variables using
option_settings:
"aws:elasticbeanstalk:application:environment":
SOME_VAR: "foo"
or for container commands using
container_commands:
00_syncdb:
command: "python manage.py db upgrade"
leader_only: true
behave as expected.
Why isn't AWS Elastic Beanstalk's static path changing when to correspond to the setting in my config file?
The ebextensions are a lower precedence setting. What this means is that if you ever set anything in your ebextensions using the cli/console/api, the ebextension will no longer take effect.
You can remove the setting using the cli/api in order to get the ebextension to work again.
Using the EB CLI you can use eb config then remove the related line from the file.
Using the AWS CLI you can use:
aws elasticbeanstalk update-environment --environment-name MyEnvName --region us-west-2 --options-to-remove Namespace=aws:elasticbeanstalk:container:python:staticfiles,OptionName=/static/
Related
I have a pipeline, that deploys my backend into aws elastic beanstalk.
i get this error
"ERROR: This directory has not been set up with the EB CLI"
even though my build folder has .elasticbeanstalk folder that has config.yml (my environment)
But it can't see it for some reason and asks me to use eb init
is there a way to solve it or a way to make eb init extract the environment from my config.yml?
i tried to eb init my-api --platform node.js --region us-east-1
but it brought me different set of errors
I have a grails app that I deploy to AWS Elastic Beanstalk through Jenkins. I want to add a splunk forwarder to my project so I can keep track of my logs outside of AWS and set up easy notifications.
The problem is, I have multiple environments of the app running (dev, pre-prod, prod, etc), which is fine because you can just change the environment name for the forwarded and be able to easily sort through that in Splunk.
However, the same .ebextensions file has to be used between all the environments, no I need a way to set the environment name to whatever AWS has the name as. Is there a way I can easily do this that I'm overlooking?
Start of the script:
container_commands:
01install-splunk:
command: /usr/local/bin/install-splunk.sh
02set-splunk-outputs:
command: /usr/local/bin/set_splunk_outputs.sh
env:
SPLUNK_SERVER_HOST: "splunk.host"
03add-inputs-to-splunk:
command: /usr/local/bin/add-inputs-to-splunk.sh
env:
ENVIRONMENT_NAME: "Development"
cwd: /root
ignoreErrors: false
That ENVIRONMENT_NAME variable I'm setting that's passed to the 3rd script is what I want to be able to change based on what environment is being deployed. Can I set this in Jenkins or pull it through AWS somehow?
You can try below steps:
Configure your AWS Elasticbeanstalk environment with the environment variable
ENVIRONMENT_NAME = 'Development' or 'QA' or 'Prod'
please refer aws-official-docs for same.
Then update config as below:
container_commands:
01install-splunk:
command: /usr/local/bin/install-splunk.sh
02set-splunk-outputs:
command: /usr/local/bin/set_splunk_outputs.sh
env:
SPLUNK_SERVER_HOST: "splunk.host"
03add-inputs-to-splunk:
command: /usr/local/bin/add-inputs-to-splunk.sh
env:
ENVIRONMENT_NAME: "$ENVIRONMENT_NAME"
cwd: /root
ignoreErrors: false
Hope this should work for you.
I am running this command to install web socket protocols in my AWS Elastic Beanstalk EC2 server
commands:
01_install_websockets:
command: "powershell.exe Install-WindowsFeature -name Web-WebSockets"
ignoreErrors: false
02_install_iis_websockets_feature:
command: "powershell.exe Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebSockets"
ignoreErrors: false
The command above was not executed in my server, running those script in the EC2 manually always works but doing this using .ebextensions does not work.
Here's the structure of my code.
And when this one is published, the .ebextensions is added at the root of the zip file
zip
- .ebextensions
- other files...
Please let me know what's missing here. I don't do any special configurations on the AWS EB.
I am able to run with following steps:
I am using container_commands but, I am confident it will work with commands as well.
---
container_commands:
"2":
command: powershell.exe -ExecutionPolicy Bypass -Command".\\.ebextensions\\IISScripts.ps1"
Zip file looks like below:
zip
- .ebextensions
- 01-windows.config
- IISScript.ps1
- other files...
EC2 instance configuration: Windows server 2019
I am following standard EBS config structure to override NGINX configuration as below. .ebextensions/nginx/conf.d/rate-limit.conf .ebextensions/nginx/conf.d/elasticbeanstalk/error429.conf
Not able to see the changes after deployment. Even when I SSH to the respective ec2 I dont see the expected files in
/etc/nginx/ or /etc/nginx/conf.d/elasticbeanstalk/
folder structure -
.ebextensions
.elasticbeanstalk
main.go
... ...etc
I'm try to describe my situation:
Have multiple AWS account, credentials is located under ~/.aws/credential
To swich to other account I'm typing:
eb init -i --profile name
Now to deploy code to accounts I must every time switch to other acc. How I can organize .ebextensions to have possibility to deploy to 10 AWS acc without switching between profiles ?
You don't need to do eb init every time. You can deploy with arguments, eb deploy --profile profile_name.
If you setup your .elasticbeanstalk/config file something like this you can have different profiles and branches for different environments without using arguments.
branch-defaults:
develop:
environment: env-develop
profile: eb-profile
master:
environment: env-master
profile: eb-profile2
global:
application_name: env_name
default_ec2_keyname: key_name
default_platform: Python 2.7
default_region: ap-southeast-1
sc: git
I haven't tried this, but if you call eb deploy environment_name --profile eb-profile3 that is linked to somewhere else it should deploy there with your branch and global specific settings (profile overriden).
eb deploy <environment name> overrides the environment name.
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb3-deploy.html
I have only read this briefly, but maybe this can help you as well.
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/ebcli-compose.html