AWS No Environment found for EnvironmentName = 'name-env' - amazon-web-services

Why might I be seeing this error after I run git aws.push?
remote: error: Unable to deploy application version: No Environment found for EnvironmentName = 'reco-api-env'.
When I grep my flask app's directory for EnvironmentName, I see this:
./.elasticbeanstalk/config:6:EnvironmentName=name-env
./.git/AWSDevTools/aws/elastic_beanstalk_config.rb:36: :environment_name => "EnvironmentName",

I had similar symptoms when I manually updated default_region from us-west-2 to us-west-1. Reverting back fixed the issue.

I suspect you missed a step in the process. You need to use eb start before doing git aws.push.

I was using eb create to setup a new environment where the name differed from what I had started with in /.elasticbeanstalk/config.yml
Once I updated the environment reference to the one one I meant to target, eb commands started working as expected.

I had this issue too. For me, it was because I had outdated credentials in my ~/.aws/config file. Fixing that solved the problem.

Related

No module named ____ error in AWS MWAA even with requirements.txt

I've uploaded my requirementst.txt to a dag and referenced it when creating my Airflow Environment. Here is what my requirements.txt looks like:
apache-airflow==1.10.12
oauth2client==4.1.3
google-api-python-client==2.2.0
Flask-AppBuilder==2.3.3
boto3==1.17.59
However, I keep getting a "No module named oauthclient" error in my airflow environment. How do I check if oauthclient is actually installed or if Airflow is not reading my requirements.txt file correctly?
Thanks in advance.
You don't need to recreate MWAA. MWAA uses versioned S3 bucket. Your requirements.txt is also versioned and stick with the old version if you don't manually make it, point to the latest version.
Just go to MWAA page, click "edit", and choose the latest version of your requirements.txt. Then it will update.
mwaa should read the requirement.txt again, if you edit the mwaa configuration through the console and press save or from cli, run:
aws mwaa update-environment --name <environment name>
Updating requirements in the MWAA is not straightforward:
Once the requirements text is changed , you have to rebuild the env again
Before you do this , please double check to make sure that you have selected the right version of the requirements .txt file in the environment creation page
Most of the time the version of .txt file is the older one, you have to manually select the newest one!
Simply editing and updating the existing environment will install the older version of the requirements.txt file!
I solved this by recreating my environment. It looks like AWS MWAA only runs your requirements.txt once and so any updates you make after you have made your environment will not be applied.

AWS Elastic Beanstalk ERROR: InvalidParameterValueError

While using command - eb deploy
I am getting below error. YAML is fine syntax wise
ERROR: InvalidParameterValueError - Each option setting in configuration file .ebextensions/environ-
v1.config in application version app-4c59-191023_045651 must be a map. Update each option setting in the configuration file.
.config file in .ebextensions folder which is in root of project
option_settings:
aws:elasticbeanstalk:application:environment:
PORT:8081
NODE_ENV:development
aws:autoscaling:launchconfiguration:
SecurityGroups:launch-123
I ran into the same issue running the AWS Deploy a Django App to Elastic Beanstalk (the tutorial does not seem to be up to date).
This AWS page has some info on the latest option setting formatting
It helped me resolve my issue which I think in your case would be including spaces after "PORT: ", "NODE_ENV: ", etc.
Also using an IDE that will highlight different words/parts of the file helped me understand how things were getting recognized.
have you tried double quotes in .config file like
"aws:elasticbeanstalk:application:environment":
instead of
aws:elasticbeanstalk:application:environment:
and, respectively,
"aws:autoscaling:launchconfiguration":
instead of
aws:autoscaling:launchconfiguration:

eb deploy ERROR: TypeError - cannot concatenate 'str' and 'NoneType' objects

Sorry I don't see this question anywhere. I've deployed an environment for my application "scones" on AWS. It's fairly simple Node.js express app. Honestly it's just to test the elastic beanstalk deployment. Anyhoo I'm using ebcli and I've already done an "eb create scones1" and it does create the environment and launches it. But when I make some changes (not committed to git) and type 'eb deploy' on the command line I receive ERROR: TypeError - cannot concatenate 'str' and 'NoneType' objects every time. Even if I enter the environment name. Doesn't matter. What is happening? None of the documentation seems to mention any error like this. Is there an issue with my Python version? I
I was having this same issue and determined it to be coming from the following line in ebcli/operations/deployops.py:
io.log_info('Deploying code to ' + env_name + " in region " + region_name)
I resolved it by explicitly specifying a region with -r REGION when executing the deploy. I imagine somewhere the default region should be configured so this does not happen.
Edit: I was able to permanently set the region with eb init --region us-east-1
Solve with a simple eb init, put my credentials, and just works.
Try git add . to stage your commits. Then, eb deploy --staged. You can check out the --staged flag here: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb3-deploy.html

Elasticbeanstalk with Docker

When I try to create new environment using docker container shows the error message, using eb create or from aws console, yes, if I just try to create an environment from web console the same messages appears.
Unknown or duplicate parameter: WSGIPath
I've followed this tutorial http://victorlin.me/posts/2014/11/26/running-docker-with-aws-elastic-beanstalk
whats's wrong?
is it a bug?
The issue was solved, there was a folder called .ebextensions in project root, just remove it and the deploy worked!

AWS Elastic Beanstalk - ERROR: No Application Version named 'v0_9_2-76-gf5a4' found

I'm trying to deploy my code to AWS Beanstalk and get this error. I researched that it could be that the number of versions is more than 500, so I deleted a lot of versions. But, I still get this error.
eb deploy
ERROR: No Application Version named 'v0_9_2-76-gf5a4' found.
I also tried
git aws.push
Error: Failed to create the AWS Elastic Beanstalk application version
Edit:
Trying with eb deploy --debug I now get:
Instance: i-2ad238d5 Module: AWSEBAutoScalingGroup ConfigSet: null Command failed on instance. Return code: 1 Output: Error occurred during build: Command hooks failed . Script /opt/elasticbeanstalk/hooks/appdeploy/pre/10_bundle_install.sh failed with returncode 18
ebcli.objects.exceptions.ServiceError: Update environment operation is
complete, but with errors. For more information, see troubleshooting
documentation.
Did you update the file .elasticbeanstalk/config.yml ? It may have a wrong setup.
Make a backup of .elasticbeanstalk/ folder and remove it
Execute eb create
Select the same region you deployed it before. You can check the region on .elasticbeanstalk/config.yml backup
A list with the environments will appear, select the right one
Deploy now
Remove the .elasticbeanstalk/config.yml backup
Check for the .elasticbeanstalk/config.yml file
environment: CORRECT_ENV_NAME
global:
application_name: CORRECT_APP_NAME
In my case, I was doing eb deploy X where X was an environment for a different project.
When I had the error
InvalidParameterValueError: No Application Version named 'app-9f5c-180927_071528' found.
I fixed this by specifying the label I wanted to push up.
eb deploy XXX-env -l XXX.0.0.1
The -l flag is documented AWS EB Deploy Docs
most likely, the deploy is trying an incorrect Elasticbeanstalk Application. it could be because you renamed the application in the AWS console.
so double check you're pointing to the correct elasticbeanstalk Environment and Application. it could be picking out default values from your .elasticbeanstalk/config.yml file.