Bitbucket integration to CodeDeploy S3 Bucket

Evangelo Rosal July 4, 2017

Dear gurus!

Web Version control is something new and I am trying to learn so don't be hard on me if I sound silly :) Unfortiunately, I created a website without considering bitbucket and codedeploy first.

I have the source files in my ec2 instance /var/www/html/ where I installed git and cloned into a bitbucket repository. 

I created an appspec.yml in my Bitbucket repository (master branch) similar to the instructions below:

https://aws.amazon.com//blogs/apn/announcing-atlassian-bitbucket-support-for-aws-codedeploy/

I have also created S3 bucket and seems successfully integrated into my Bitbucket. It is still empty even after the integration.

This is the confusing part for me:

Why do I need the S3 bucket for? I already have the source files in my ec2 instance so anything I approve via bitbucket should directly update the files in the web server.

If the S3 bucket serves as another gateway between changes in bitbucket and the web server then how can I transfer the files from the web server into the S3 bucket? I tried to create appspec.yml in /var/www/html and push into S3 bucket but I get the error: Failed to upload "." to <s3 bucket>: Unable to locate credentials.

 

Using pipeline is another story which I plan to create another thread. It keep failing my builds with error PDOException driver not found (I installed composer on both my ec2 instance and local computer).

 

1 answer

0 votes
Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 20, 2019

I can't answer for the Bitbucket integration problem (if you have one), but to clarify some confusion about how CodeDeploy works.

anything I approve via bitbucket should directly update the files in the web server

That's not how CodeDeploy works. Bitbucket should push a copy of your repository to the S3 bucket. CodeDeploy will pull that copy out of S3 and deploy it to your web server using the code deploy agent. Additionally, CodeDeploy may run some script hooks (if you have created any), and will validate the overall success of the deployment. If it fails, it will roll back to the previous version of your app on the instance and tell you the deployment failed.

how can I transfer the files from the web server into the S3 bucket

You shouldn't be doing that. If you want to use CodeDeploy to this web server, the server should NOT have Git, and you shouldn't be doing any major editing there.

 

Some other notes:

appspec.yml tells CodeDeploy what to do on your instance. It does NOT give any instructions to BitBucket on how to send your app to CodeDeploy - that's done somewhere in the BitBucket interface.

Based on reviewing the documentation you linked, it looks like you should not see anything in your S3 bucket until you hit the "Deploy to AWS" button somewhere in the BitBucket interface. This should upload a .zip of your repository to the S3 bucket if everything is configured correctly.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events