June 23, 2020 / Nirav Shah
Do you have a PHP project in bitbucket and you wanted to know how to set up your bitbucket Auto pipeline to push the PHP files directly on AWS EC2. So here you go.
Assumption
So here we have set up simple “production” branch pipeline bitbucket-pipelines.yml
pipelines:
default:
- step:
name: Push
script:
# Build and push image
- pipe: atlassian/rsync-deploy:0.4.3
variables:
USER: 'ubuntu'
SERVER: ‘XX.XX.XX.XX’
REMOTE_PATH: '/var/www/yourwebsite.com'
LOCAL_PATH: ${BITBUCKET_CLONE_DIR}/*
SSH_KEY: $MY_SSH_KEY
DEBUG: 'true'
rsync-deploy is famous for its data transfer algorithms, which reduces the data transfer by sending only differences between source files in the destination. So it’s faster.
Core PHP doesn’t require any kind of build or third party dependency installation, so its simple.
Please configure your SSH_KEY inside your repository section settings.
Also Read: Enabling root login to the server with SSH login

Nirav Shah is the Director of Eternal Web Pvt Ltd, an AWS Advanced Consulting Partner and certified Odoo Partner based in the UK. With over a decade of experience in cloud computing, digital transformation, and ERP implementation, Nirav helps enterprises adopt the right technology to solve complex business challenges. He specialises in AWS infrastructure, Odoo ERP, and web development solutions for businesses across the UK and beyond.
Have queries about your project idea or concept? Please drop in your project details to discuss with our AWS Global Cloud Infrastructure service specialists and consultants.