-2

I am new to AWS. My company asked me to deploy a CRUD API via docker on EC2. I cloned our codecommit repo into the ec2 instance and built the image. I was also able to navigate through the repository. However, today when I logged in to the ec2 instance, I couldn't find the repo I had cloned the day before, though the image I built still shows up when I execute "docker images". The docker container also runs without any problems. The only files I can see after "ls" are the ones created by AWS. Can someone help with this? Is it supposed to be like this? If not, how can I ensure this doesn't happen again? Thanks!

  • You are mixing two different things, Docker and EC2 instance, you can use only EC2 without Docker and Docker without EC2, can you better explain the process you are following to deploy? – wolmi Oct 14 '20 at 10:37
  • Yes. I actually cloned the repo in the instance so that I could easily build docker images from that directory itself. I thought it'd also be easier to update the image if I make some changes to the code. I then create and run the docker container to serve the api which uses FastApi on it's back-end. But again, as I said, I am a beginner to aws, and there might be better ways of achieving this. – Shashwat Oct 14 '20 at 19:59

1 Answers1

1

after reading your question , it seems that you have lost your added repository . it can happen if:

You have Launched your Instance from Amazon AMI backed by Instance store volume and you have stopped your instance after that and started again.

Instance store volume data doesnt persist if you stop your instance .. to persist data you need to use EBS Volume

Ravindra Bagale
  • 17,226
  • 9
  • 43
  • 70