Continuous Delivery
com Bitbucket e
AWS
Hermenegildo Marin Júnior
@hmarinjr
PHP Developer
A2C Agência
https://www.a2c.com.br/
Schedule
● Continuous Delivery
● Serviços AWS
○ S3
○ IAM Role
○ AIM
○ EC2
○ CodeDeploy
● Bitbucket
○ Pipelines
● Referências
Continuous Delivery
Continuous Delivery
● Automate the manual steps in deploy process.
● Automate updating environments with the latest code.
Identity Access Management
(IAM)
A user needs to be created that Bitbucket can use to upload artifacts to S3 and
inform CodeDeploy that a new revision is ready to be deployed.
IAM Group Role
This group needs this permissions:
● AmazonS3FullAccess
● AWSCodeDeployFullAccess
Add User
● Programatic Access only
● Save the access keys
Create Role
Associated to EC2 instances and interact with CodeDeploy.
● Trusted entities
○ EC2
● Policies
○ AWSCodeDeployRole
○ AmazonS3FullAccess
● Edit Trust Relationship
Trust Relationships
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": [
"ec2.amazonaws.com",
"codedeploy.us-west-2.amazonaws.com"
]
},
"Action": "sts:AssumeRole"
}
]
To recap
We created a new IAM user that belongs to a group that has full CodeDeploy and S3
permissions. We wrote down this user’s access key information for later use.
We then created an IAM role for EC2 and edited the trust relationship to also allow
access to CodeDeploy.
S3
A bucket needs created that will store
the revisions of your application.
EC2
Configuration details are all default except
for IAM role of CodeDeploy.
Use a tag to identify:
Name=Code Deploy Instance
CodeDeploy
Install the agent needs to be installed on the instance.
Depends of your OS, we have to install:
● Ruby >=2.0
● AWS CLI
● Start AWS CLI
CodeDeploy
CodeDeploy
● Give the Application and the Deployment Group a name.
● Select EC2/On-premises and In-place deployment.
Code Deploy
Code Deploy
Select Amazon EC2 instances
Code Deploy
Leave the Deployment Configuration set to CodeDeployDefault.OneAtATime
Code Deploy
The service role should be set to the IAM role that was created earlier.
Bitbucket
Environment variables
Pipelines
SHOW ME THE CODE!!!!
Referências
● Install and configure all AWS Services:
https://hackernoon.com/deploy-to-ec2-with-aws-codedeploy-from-bitbucket-
pipelines-4f403e96d50c
● Install CodeDeploy agent in ubuntu:
https://docs.aws.amazon.com/codedeploy/latest/userguide/codedeploy-agent-
operations-install-ubuntu.html
● Portuguese tutorial in AWS:
https://docs.aws.amazon.com/pt_br/codepipeline/latest/userguide/tutorials-
simple-codecommit.html
Continuous delivery with aws and bitbubket

Continuous delivery with aws and bitbubket