title: CI / CD: Principles for deployment of environments
body: <p>I am not a developer, but reading about CI/CD at the moment. Now I am wondering about good practices for automated code deployment. I read a lot about the deployment of code to a pre-existing environment so far.</p>
  
  <p>My question now is whether it is also good-practice to use e.g. a Jenkins workflow to deploy an environment from scratch when a new build is created. For example for testing of a newly created build, deleting the environment again after testing. </p>
  
  <p>I know that there are various plugins to interact with AWS, Azure etc. that could be used to develop a job for deployment of a virtual machine.
  There are also plugins to trigger Puppet to deploy infra (as code) and there are plugins to invoke an infrastructure orchestration.
  So everything is available to be able to deploy the infrastructure and middleware before deploying code (with some extra effort of course).</p>
  
  <p>Is this something that is used in real life? How is it done?</p>
  
  <p>The background of my question is my interest in full automation of development with as few clicks as possible, and cost saving in a pay-per-use model by not having idle machines.</p>