AWS continuous integration and continuous delivery
- Create a repo in the github account.
- push the code into the repo.
- create docker file.
- create buildspec file.
- create appspec file.
- create requirements file.
- Goto code build and create build project [ add on name, description, source, runtime, image, service role, insert build spec, create.]
- Create new service role [add on codebuild,SSM,name,description,create.]
- Goto systems manager and open parameters store [add on docker username, password, registry url separetly.]
- Strat build.
- Goto Build project ,click on edit ,click on environment, click on override image, enable privileged,update.
- Now rebuild
- Create pipeline [add on name, service role, source, code build, project name, single build, create.]
-
Goto code deploy on console.
-
click on create application.
-
[add on a name , platfrom(ec2)]
-
Click on create application.
-
Goto EC2 instance,
-
create an ec2 instance.
-
Login to ec2 instance using terminal,
-
install code agent for ec2 instance,
Sudo apt install wget
wget https://bucket-name.s3.region-identifier.amazonaws.com/latest/install [ edit the bucket name based on the region, use https://docs.aws.amazon.com/codedeploy/latest/userguide/resource-kit.html#resource-kit-bucket-names]
chmod +x ./install
sudo ./install auto //CodeDeploy agent on any supported version of Ubuntu
sudo service codedeploy-agent start //To start service
- Goto IAM.
- Create role.
- select use case as code deploy.
- Next,[add on name, description]
- Create role.
//Assign role to EC2
-
Goto instance,
-
Click on actions,
-
click on security,
-
click on modify iam role,
-
select and update.
-
Goto terminal restart the agent sudo service codedeploy-agent restart.
-
Create Deployment group,
-
[add on name, service role, inplace, ec2, tags, unable loadbalancer, create.]
-
Attach ec2 full access to the code deploy service role.
-
Create deployment [add on deployment group name,github,token,repo name, commit id, create.]
-
Install docker sudo apt install docker.io -y
-
Goto code pipeline and edit,
-
Add stage [add on name code deploy, add action group, action name, action provider, application name, deployment group, build artefacts, done.]
-
List out running container Sudo docker ps
-
Access the port with inbound and outbound traffic rules.