Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I can't delete my test environment #1822

Closed
Kylir opened this issue Jan 13, 2021 · 5 comments
Closed

I can't delete my test environment #1822

Kylir opened this issue Jan 13, 2021 · 5 comments
Labels
guidance Issue requesting guidance or information about usage

Comments

@Kylir
Copy link

Kylir commented Jan 13, 2021

Hi there!

I'm using copilot version 1.0.0.
I have an issue: I'm not able to delete an environment and I have no idea how to find why.

This is the command and the response I get after 10 or so minutes.

$ copilot env delete --name test --yes
✘ Failed to delete environment test from application my-application.
✘ delete environment test stack: wait until stack my-application-test delete is complete: ResourceNotReady: failed waiting for successful resource state

I wanted to get rid of an application with 3 pipelines, 4 services and 1 RDS (MySQL) instance created on the VPC manually.
I did an copilot app delete and it failed at the environment part.
I deleted the MySQL instance thinking it could somehow interfere and tried again with no more luck.

When I list the environment I got this:

$ copilot env show
Only found one application, defaulting to: my-application
Only found one environment, defaulting to: test
About

  Name              test
  Production        false
  Region            eu-west-2
  Account ID        <I removed that info>

Services

  Name              Type
  ----              ----

Tags

  Key                  Value
  -------------------  -------------
  copilot-application  my-application
  copilot-environment  test

Do you know what is happening?
Where can I find more info?

Many thanks for the super tool you created!

@efekarakus efekarakus added the guidance Issue requesting guidance or information about usage label Jan 13, 2021
@efekarakus
Copy link
Contributor

efekarakus commented Jan 13, 2021

Hi @Kylir !

Can you take a look at the "Events" tab for the "my-application-test" stack in CloudFormation? That should help us narrow down the issue. If you scroll down eventually there should be a resource that failed to delete first.

Screen Shot 2021-01-12 at 4 23 31 PM
Sample screenshot of the Events tab

We're actively working on bringing this visibility to the tool atm (#1742)

@Kylir
Copy link
Author

Kylir commented Jan 13, 2021

Ah! Thank you very much! I followed your advice and I found the following:

resource sg-0dd4538d0c17bbfc6 has a dependent object (Service: AmazonEC2; Status Code: 400; Error Code: DependencyViolation; Request ID: 061bc880-b6e7-4bfc-b7b1-06775eb552e1; Proxy: null)

And several other errors all pointing to the same EC2 instance.
Looks like I have to delete that instance.

Out of curiosity, I created that EC2 instance to interact with the MySQL database that is interacting with the services (using the VPC and subnets.)
Is there a better way to create DBs and VMs that I can keep even if I delete the Copilot Environments?

Anyway, thanks again for the lightning fast and very helpful response! 👍
Feel free to close and I'll reopen if getting rid of the EC2 instance does not solve my issue.

@efekarakus
Copy link
Contributor

Ah if the DBs and VMs are created within the Copilot environment VPC, there isn't a way at the moment of deleting the Copilot Environment while retaining the VPC itself.

Until we provide that functionality, maybe a safe way would be to create a VPC outside of Copilot, and then running copilot env init and choosing to import an existing VPC. This way when the Copilot environment is deleted the VPC won't be touched.

@Kylir
Copy link
Author

Kylir commented Jan 13, 2021

Ah! This is what I missed! I wanted to create a new app with the --domain option.
I assumed I will need to destroy everything and then recreate from scratch! My fault!

@Kylir
Copy link
Author

Kylir commented Jan 13, 2021

A little update: the culprit was a security group I added to the VPC manually and forgot about!
Thanks again for your help!

@Kylir Kylir closed this as completed Jan 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
guidance Issue requesting guidance or information about usage
Projects
None yet
Development

No branches or pull requests

2 participants