Elastic Beanstalk not terminating environment from pipeline



I am building a CodePipeline to deploy application versions on an Elastic Beanstalk environment using the Blue/Green strategy. I have created three lambda functions in NodeJs to:

  1. Create the green environment;
  2. Swap the CNAMEs, and;
  3. Reswap and terminate the green environment.

The third lambda function successfully swaps the CNAMEs back, but it fails to terminate the green environment, I am receiving the following error: "InvalidParameterValue: Cannot terminate environment named TesteNovosLambdasGreen. It is currently pending deployment". I can, however, terminate the environement from the console, from the aws cli and directly from the lambda function. I also have a lambda function in Python that does exactly the same and it terminates the environment successfully.

Does anyone know what this error means and how can I fix it?

Regards, Silas F. Lopes

1 Answer

Hey Silas,

Based on the error message, it can the case that the environment was still on updating state when trying to delete it. To provide a more specific support, I would recommend you to reach out to AWS Support and share with your Lambda logs and Pipeline logs, we can take a closer look to see what was happening exactly. Thanks!

answered 2 years ago
  • Hello Zhiyuan.

    Thanks for the answer. I have already reached out to AWS Support. They have suggested I post on AWS forums because they were not able find a reason for this error.

    The deployment does not occur in this environment. It is just created to receive traffic while my Blue environment receives the new application version. Besides, my Lambda function checks the environment state before terminating it and I have a Python version of this Lambda that executes successfully


You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions