> For the complete documentation index, see [llms.txt](https://tkssharma-devops.gitbook.io/devops-training/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tkssharma-devops.gitbook.io/devops-training/devops-01-continuous-integration/aws-code-pipeline-ci-cd/aws-ci-cd-tools/aws-code-deploy.md).

# AWS Code Deploy to Beanstalk

## Deploy Node JS code to elastic beanstalk&#x20;

![](https://3776180966-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LgLv25e2BrxRC5m6flh%2F-LkIWPTgLJBEJydPshs0%2F-LkIIKfSgvtTCJ65R8sS%2FScreen%20Shot%202019-07-21%20at%2012.19.33%20PM.png?alt=media\&token=261a38c6-306d-4938-98a4-ebbff6bde044)

{% embed url="<https://www.youtube.com/watch?v=YxcIj_SLflw>" %}

Lets create Code Pipeline and send Node JS code to Beanstalk&#x20;

* create pipeline project&#x20;

![](https://3776180966-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LgLv25e2BrxRC5m6flh%2F-LkIGuCd7UApSJz_xANs%2F-LkICsTPB2hc03SqJhkm%2FScreen%20Shot%202019-07-21%20at%2011.40.15%20AM.png?alt=media\&token=15b90269-e591-48db-b067-bffb189dbe85)

Connect pipeline as Github Source Provider&#x20;

![](https://3776180966-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LgLv25e2BrxRC5m6flh%2F-LkIGuCd7UApSJz_xANs%2F-LkICvHl9d9qjPTb-ZDe%2FScreen%20Shot%202019-07-21%20at%2011.40.50%20AM.png?alt=media\&token=f975ff82-0bff-4c31-ba3e-35aa8d52215f)

Add Build stage | Create new Build Project&#x20;

![](https://3776180966-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LgLv25e2BrxRC5m6flh%2F-LkIGuCd7UApSJz_xANs%2F-LkICyCMoFLAoDZkqoXK%2FScreen%20Shot%202019-07-21%20at%2011.41.03%20AM.png?alt=media\&token=5e128310-a8c9-4650-b618-92f6a2dc6fdd)

Provide Code Build details such as managed image and image type

![](https://3776180966-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LgLv25e2BrxRC5m6flh%2F-LkIGuCd7UApSJz_xANs%2F-LkID-zJMLhZ1S6TLNTY%2FScreen%20Shot%202019-07-21%20at%2011.41.39%20AM.png?alt=media\&token=7313075b-eae3-43e7-9dfb-72f80112a036)

Provide build spec file either from code or create a file here using editor&#x20;

![](https://3776180966-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LgLv25e2BrxRC5m6flh%2F-LkIGuCd7UApSJz_xANs%2F-LkID2kLOo9lhM9FejmF%2FScreen%20Shot%202019-07-21%20at%2011.42.10%20AM.png?alt=media\&token=7e2856d2-e971-4065-a4c1-a8eca7534788)

Save Code Build Configuration which will just create \*\*/\* artifacts for us and pass this to next pipeline Phase&#x20;

![](https://3776180966-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LgLv25e2BrxRC5m6flh%2F-LkIGuCd7UApSJz_xANs%2F-LkID6CvRMLsx3Ji8q2M%2FScreen%20Shot%202019-07-21%20at%2011.43.42%20AM.png?alt=media\&token=075ab6da-3006-4718-9ecc-31c1757cade0)

Now Code Deploy Phase where we can set multiple Targets like Code deploy or Elastic beanstalk or S3 (List of options available )

![](https://3776180966-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LgLv25e2BrxRC5m6flh%2F-LkIGuCd7UApSJz_xANs%2F-LkID9vVdgl8NLn32e6p%2FScreen%20Shot%202019-07-21%20at%2011.43.53%20AM.png?alt=media\&token=cc48059d-57b7-4b2d-a132-6a61bd5a09fe)

Lets deploy this to elastic beanstalk&#x20;

![](https://3776180966-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LgLv25e2BrxRC5m6flh%2F-LkIGuCd7UApSJz_xANs%2F-LkIDCfwk5o8gHG3XhCv%2FScreen%20Shot%202019-07-21%20at%2011.46.22%20AM.png?alt=media\&token=96183a75-3550-4f4c-b82b-8df49e8cbb41)

Add Elastic beanstalk App name and environments&#x20;

![](https://3776180966-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LgLv25e2BrxRC5m6flh%2F-LkIGuCd7UApSJz_xANs%2F-LkIDF5UGYPIS-haYaFT%2FScreen%20Shot%202019-07-21%20at%2011.46.47%20AM.png?alt=media\&token=b55c9cbd-70ea-4b1e-a82b-c37b4571f6bf)

Here we go our full pipeline end to end to deploy node JS application&#x20;

![](https://3776180966-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LgLv25e2BrxRC5m6flh%2F-LkIGuCd7UApSJz_xANs%2F-LkIDHnZ9zY6RV6z67_o%2FScreen%20Shot%202019-07-21%20at%2011.47.37%20AM.png?alt=media\&token=8140a990-f9cb-4c2d-acac-df4ab4176001)

We can create Elastic beanstalk application as new application (its its not created earlier)

![](https://3776180966-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LgLv25e2BrxRC5m6flh%2F-LkIGuCd7UApSJz_xANs%2F-LkIDUmtIexeAPcDhaQ3%2FScreen%20Shot%202019-07-21%20at%2012.00.51%20PM.png?alt=media\&token=c52c003e-6bc8-4ba9-b35a-9f5054734332)

Now Just do code push on your GitHub repo, send a commit it will trigger pipeline.

![](https://3776180966-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LgLv25e2BrxRC5m6flh%2F-LkIGuCd7UApSJz_xANs%2F-LkIDN5XkVwBF67rsTII%2FScreen%20Shot%202019-07-21%20at%2011.58.04%20AM.png?alt=media\&token=02c7f0b6-3c4d-46bb-ba47-2f97172c4557)
