Skip to content

Commit f28487f

Browse files
author
ranjeet-pivotchain
committed
aws
1 parent b1728cd commit f28487f

File tree

9 files changed

+1591
-1346
lines changed

9 files changed

+1591
-1346
lines changed

aws-devops/aws-code-commit/README

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
################### AWS CODECOMMIT #######################
2+
1] login to aws account
3+
4+
2] go to aws codecommit service.
5+
6+
3] create repo
7+
8+
4] create one IAM user for accessing the repos, create access key and secret github credintial for that created user.
9+
10+
11+
5] create admin user and admin group(admin group has full access)
12+
This is the admin user responsible for merging the requests.. this user present in only admin group.
13+
admin user:
14+
helm-at-804872348047
15+
16+
17+
6] create junior dev group and dev user and add this user in junior dev group:
18+
create junior dev group and add below custompolicy to this group so that this group member can't directory commit/push/merge to master branch,
19+
make sure this dev users present in admin group also so that they can pull the code.
20+
dev user:
21+
codecommit-at-804872348047
22+
23+
24+
{
25+
"Version": "2012-10-17",
26+
"Statement": [
27+
{
28+
"Effect": "Deny",
29+
"Action": [
30+
"codecommit:GitPush",
31+
"codecommit:DeleteBranch",
32+
"codecommit:PutFile",
33+
"codecommit:MergeBranchesByFastForward",
34+
"codecommit:MergeBranchesBySquash",
35+
"codecommit:MergeBranchesByThreeWay",
36+
"codecommit:MergePullRequestByFastForward",
37+
"codecommit:MergePullRequestBySquash",
38+
"codecommit:MergePullRequestByThreeWay"
39+
],
40+
"Resource": "arn:aws:codecommit:*:*:*",
41+
"Condition": {
42+
"StringEqualsIfExists": {
43+
"codecommit:References": [
44+
"refs/heads/master"
45+
]
46+
},
47+
"Null": {
48+
"codecommit:References": "false"
49+
}
50+
}
51+
}
52+
]
53+
}
54+
55+
56+
57+
7] create one branch and push this branch using dev user to repo.
58+
59+
8] create PR using dev user. and accept this PR using admin user.
60+
61+
62+
63+
64+

aws-devops/aws-code-commit/app.js

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
var port = process.env.PORT || 3000,
2+
http = require('http'),
3+
fs = require('fs'),
4+
html = fs.readFileSync('index.html');
5+
6+
var log = function(entry) {
7+
fs.appendFileSync('/tmp/sample-app.log', new Date().toISOString() + ' - ' + entry + '\n');
8+
};
9+
10+
var server = http.createServer(function (req, res) {
11+
if (req.method === 'POST') {
12+
var body = '';
13+
14+
req.on('data', function(chunk) {
15+
body += chunk;
16+
});
17+
18+
req.on('end', function() {
19+
if (req.url === '/') {
20+
log('Received message: ' + body);
21+
} else if (req.url = '/scheduled') {
22+
log('Received task ' + req.headers['x-aws-sqsd-taskname'] + ' scheduled at ' + req.headers['x-aws-sqsd-scheduled-at']);
23+
}
24+
25+
res.writeHead(200, 'OK', {'Content-Type': 'text/plain'});
26+
res.end();
27+
});
28+
} else {
29+
res.writeHead(200);
30+
res.write(html);
31+
res.end();
32+
}
33+
});
34+
35+
// Listen on port 3000, IP defaults to 127.0.0.1
36+
server.listen(port);
37+
38+
// Put a friendly message on the terminal
39+
console.log('Server running at http://127.0.0.1:' + port + '/');

aws-devops/aws-code-commit/cron.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
version: 1
2+
cron:
3+
- name: "task1"
4+
url: "/scheduled"
5+
schedule: "* * * * *"

aws-devops/aws-code-commit/index.html

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Elastic Beanstalk</title>
5+
<style>
6+
body {
7+
color: #ffffff;
8+
font-family: Arial, sans-serif;
9+
font-size:14px;
10+
-moz-transition-property: text-shadow;
11+
-moz-transition-duration: 4s;
12+
-webkit-transition-property: text-shadow;
13+
-webkit-transition-duration: 4s;
14+
text-shadow: none;
15+
}
16+
body.blurry {
17+
-moz-transition-property: text-shadow;
18+
-moz-transition-duration: 4s;
19+
-webkit-transition-property: text-shadow;
20+
-webkit-transition-duration: 4s;
21+
text-shadow: #fff 0px 0px 25px;
22+
}
23+
a {
24+
color: #55aaff;
25+
}
26+
.textColumn, .linksColumn {
27+
padding: 2em;
28+
}
29+
.textColumn {
30+
position: absolute;
31+
top: 0px;
32+
right: 50%;
33+
bottom: 0px;
34+
left: 0px;
35+
36+
text-align: right;
37+
padding-top: 11em;
38+
background-color: blue;
39+
40+
}
41+
.textColumn p {
42+
width: 75%;
43+
float:right;
44+
}
45+
.linksColumn {
46+
position: absolute;
47+
top:0px;
48+
right: 0px;
49+
bottom: 0px;
50+
left: 50%;
51+
52+
background-color: #33342D;
53+
}
54+
55+
h1 {
56+
color: #33342D;
57+
font-size: 500%;
58+
font-weight: normal;
59+
margin-bottom: 0em;
60+
}
61+
h2 {
62+
font-size: 200%;
63+
font-weight: normal;
64+
margin-bottom: 0em;
65+
}
66+
ul {
67+
padding-left: 1em;
68+
margin: 0px;
69+
}
70+
li {
71+
margin: 1em 0em;
72+
}
73+
</style>
74+
</head>
75+
<body>
76+
<div class="textColumn">
77+
<h1>Congratulations</h1>
78+
<p>Your first AWS Elastic Beanstalk Node.js application is now running on your own dedicated environment in the AWS Cloud</p>
79+
</div>
80+
<div class="linksColumn">
81+
<h2>What's Next?</h2>
82+
<ul>
83+
<li><a href="http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/Welcome.html">AWS Elastic Beanstalk overview</a></li>
84+
<li><a href="http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/concepts.html">AWS Elastic Beanstalk concepts</a></li>
85+
<li><a href="http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_nodejs_express.html">Deploy an Express Application to AWS Elastic Beanstalk</a></li>
86+
<li><a href="http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_nodejs_express_elasticache.html">Deploy an Express Application with Amazon ElastiCache to AWS Elastic Beanstalk</a></li>
87+
<li><a href="http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_nodejs_geddy_elasticache.html">Deploy a Geddy Application with Amazon ElastiCache to AWS Elastic Beanstalk </a></li>
88+
<li><a href="http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_nodejs_custom_container.html">Customizing and Configuring a Node.js Container </a></li>
89+
<li><a href="http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.loggingS3.title.html">Working with Logs</a></li>
90+
</ul>
91+
</div>
92+
</body>
93+
</html>
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "Elastic-Beanstalk-Sample-App",
3+
"version": "0.0.1",
4+
"private": true,
5+
"dependencies": {},
6+
"scripts": {
7+
"start": "node app.js"
8+
}
9+
}

aws-devops/aws-code-pipeline/README

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Prerequisites:
2+
create two elastic beanstalks env.. 1] my-first-webapp 2] prod env....deloy version is nodejs
3+
4+
create pipeline..give name....source--> codecommit--->branch--->deploy-to-aws-elasticbeanstalk..and select above created env....
5+
6+
again add stages like manual approval and deloytoprod.
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
version: 0.2
2+
3+
phases:
4+
install:
5+
runtime-versions:
6+
nodejs: latest
7+
commands:
8+
- echo "installing something"
9+
pre_build:
10+
commands:
11+
- echo "we are in the pre build phase"
12+
build:
13+
commands:
14+
- echo "we are in the build block"
15+
- echo "we will run some tests"
16+
- grep -Fq "Congratulations" index.html
17+
post_build:
18+
commands:
19+
- echo "we are in the post build phase"
20+

0 commit comments

Comments
 (0)