To deploy a new Magento store automatically via Bitbucket CI. Follow the following steps.
1. Set the following environment variables for the bitbucket repo with the magento store source code
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-west-2 #or any aws region you'd like to run your app in
AWS_EB_PLATFORM=php-5.6 # this needs to be set to 5.6, which supports both Magento 1.x and 2.x sites
DB_USERNAME= # MySQL Database username
DB_PASSWORD= # MySQL Database password
DB_SIZE= # MySQL Database size, from 5GB-1024GB
To do this, got to Settings -> Pipelines -> Environment Variables Be sure to check the Secure variable setting for the AWS credentials. This will stop Bitbucket from printing the keys anywhere in cleartext.
2. Copy the above bitbucket-pipelines.yml
file to the root of the repo with the Magento source code.
3. Git push your code!
That's all you need to do!
To watch the build run, and to get the url at which the new Magento store will become available, go to Pipelines and click on the pipeline with your commit.
The RDS Database details will be available to your app via the following environment variables;
RDS_HOSTNAME – The hostname of the DB instance.
Amazon RDS console label – Endpoint is the hostname.
RDS_PORT – The port on which the DB instance accepts connections. The default value varies between DB engines.
Amazon RDS console label – Port
RDS_DB_NAME – The database name, ebdb.
Amazon RDS console label – DB Name
RDS_USERNAME – The user name that you configured for your database.
Amazon RDS console label – Username
RDS_PASSWORD – The password that you configured for your database.