Go to Bitbucket / Settings / Pipelines / Settings
and enable pipelines

Go to parameters and set the following where:
- AWS_DEFAULT_REGION is the region where the EC2 instance has been created
- AWS access key and secret access key are the keys associated with the EC2 instance.
- APPLICATION_NAME
- DEPLOYMENT_GROUP_NAME
- S3_BUCKET
- DEPLOYMENT_CONFIG
are the values used when defining the AWS CodeDeploy configuration.

Now generate a pull request and hopefully you will have a success