Answers: <p>Yes you can create a new deployment directly from Github, but that will require that you set up a GitHub authentication with applications in CodeDeploy. You might not be able to set up this deployment if you don't have admin access to the repository.</p>
  <p>Also, using S3 is a good way to implement &quot;decoupled architecture&quot;. Read more here: <a href="https://www.techtarget.com/whatis/definition/decoupled-architecture" rel="nofollow noreferrer">https://www.techtarget.com/whatis/definition/decoupled-architecture</a></p>
  <blockquote>
  <p>In general, a decoupled architecture is a framework for complex work that allows components to remain completely autonomous and unaware of each other. Cloud computing is sometimes said to have a decoupled architecture because the cloud provider manages the physical infrastructure, but not the applications or data hosted on it.</p>
  </blockquote>
  <p>By using S3 as the location to upload your source code, if in the future you move away from Github and change into Gitlab or on-premise Git repository, you don't need to change anything on the CodeDeploy side. This is because CodeDeploy expect the source code to be in S3, and will start the deployment once a new S3 upload trigger happen.</p>
  
Answers: CC BY-SA 4.0
Answers: 2024-09-28T19:59:09.547Z
Answers: 2024-09-28T19:59:09.547Z
Answers: Sharuzzaman Ahmat Raslan
Body: <p>Following tutorials like <a href="https://blog.cetre.co.uk/how-to-use-github-actions-and-aws-codedeploy-for-automated-ci-cd-builds-and-deployment/" rel="nofollow noreferrer">this one</a>, I managed to set up a continuous deployment pipe to deploy automatically via AWS CodeDeploy to my EC2 instance using GitHub actions, triggered on merging (or rather pushing) to the main branch. In most of these tutorials, an AWS S3 bucket is specified explicitly, and an <code>aws s3 sync</code> command is included in the GitHub Actions YAML file (again, like in the tutorial).</p>
  <p>However, I realised that one need not specify (or even manually create) and S3 bucket for the deployment to work. Instead, just the following command example is enough for the workflow to deploy:</p>
  <p><code>aws deploy create-deployment --application-name ${{ env.codedeployapp }} --deployment-group-name ${{ env.codedeploygrp }} --deployment-config-name CodeDeployDefault.OneAtATime --github-location repository=${{ github.repository }},commitId=${{ github.sha }}</code></p>
  <p>Why do these tutorials manually create an S3 bucket when not required? I want to make sure that I'm not missing something obvious in my setup.</p>
  
Tags: <amazon-s3><github-actions><aws-codedeploy>
Title: CD with CodeDeploy and GitHub Actions - why specify S3 bucket?
UserDisplayName: Trettman
ThreadText: # CD with CodeDeploy and GitHub Actions - why specify S3 bucket?
  
  (Asked by: username_0 on 2024-09-25)
  
  Following tutorials like [this one](https://blog.cetre.co.uk/how-to-use-github-actions-and-aws-codedeploy-for-automated-ci-cd-builds-and-deployment/), I managed to set up a continuous deployment pipe to deploy automatically via AWS CodeDeploy to my EC2 instance using GitHub actions, triggered on merging (or rather pushing) to the main branch. In most of these tutorials, an AWS S3 bucket is specified explicitly, and an `aws s3 sync` command is included in the GitHub Actions YAML file (again, like in the tutorial).
  
  However, I realised that one need not specify (or even manually create) and S3 bucket for the deployment to work. Instead, just the following command example is enough for the workflow to deploy:
  
  `aws deploy create-deployment --application-name ${{ env.codedeployapp }} --deployment-group-name ${{ env.codedeploygrp }} --deployment-config-name CodeDeployDefault.OneAtATime --github-location repository=${{ github.repository }},commitId=${{ github.sha }}`
  
  Why do these tutorials manually create an S3 bucket when not required? I want to make sure that I'm not missing something obvious in my setup.
  
  **Tags:** amazon-s3, github-actions, aws-codedeploy
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-09-28. Score: 0
  
  Yes you can create a new deployment directly from Github, but that will require that you set up a GitHub authentication with applications in CodeDeploy. You might not be able to set up this deployment if you don't have admin access to the repository.
  
  Also, using S3 is a good way to implement "decoupled architecture". Read more here: <https://www.techtarget.com/whatis/definition/decoupled-architecture>
  
  > In general, a decoupled architecture is a framework for complex work that allows components to remain completely autonomous and unaware of each other. Cloud computing is sometimes said to have a decoupled architecture because the cloud provider manages the physical infrastructure, but not the applications or data hosted on it.
  
  By using S3 as the location to upload your source code, if in the future you move away from Github and change into Gitlab or on-premise Git repository, you don't need to change anything on the CodeDeploy side. This is because CodeDeploy expect the source code to be in S3, and will start the deployment once a new S3 upload trigger happen.
  
  
  ---
  
  