AWS code pipeline
is a fully managed continuous delivery service that helps you to automate your release pipelines for fast and reliable application and infrastructure updates.
Automates the build,test and deploy phases of release process every time there is a change in code based on release model you defined.
This enables you to every time you deliver features and updates of app.
We can easily integrate AWS services such as GitHub or with your custom plugin.
First Host a static website on AWS S3.
Create a bucket with name



Make a note of End point and click "Save".
Edit the block public access and enable public access , so that you can access this bucket outside.

Click "Save"

Add a bucket policy that your content in the bucket will be publicly available

{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": [
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::mywebsite3009/*"
]
}
]
}
Click "save"
you can ignore the following warning message if you would like to give access to the public.

entry.html:
<html>
<head>
<title>My static Website Home Page</title>
</head>
<body>
<h1>Welcome to my sample website</h1>
<p>Am hosted on Amazon S3!</p>
</body>
</html>
Upload to the S3 bucket

In my case the below is the figure .

We have now successfully hosted static website on S3.
Now we can select "codepipeline" under AWS services


Give your Github account name and select the repository name.





Select "Next" and review the details and select "create pipeline"
Now we have created successfully created pipeline.

Change something in "my-app" source code and check the git status.

and push the changes to github.

you can have same website files which are uploaded to S3 and github will be same.
So that when you change the code of your website , it automatically reflect the change when you push.
Since have my Java project connected with S3 via pipeline, when you push the changes of your updated java file to github. the updated file will be shown under S3.

Now you can open sample.java , it will be shown as we have updated as below
Sample.java:
public class sample {
public static void main(String args[]){
System.out.println("Thiis is my app which is created in pipeline");
}
}
This is how codepipeline will work with static website, java project and github changes.
Thank you for reading.
No comments:
Post a Comment