Skip to content

Commit

Permalink
RDS Instance Type & Identifier added
Browse files Browse the repository at this point in the history
  • Loading branch information
umutykaya committed May 29, 2021
1 parent 0391dce commit f1038b1
Showing 1 changed file with 22 additions and 14 deletions.
36 changes: 22 additions & 14 deletions lib/cdk-spring-pipeline-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,18 @@ import elbv2 = require('@aws-cdk/aws-elasticloadbalancingv2');
import acm = require('@aws-cdk/aws-certificatemanager');
import route53 = require('@aws-cdk/aws-route53');

const myIP = '24.133.236.1/32'; // IP address from which you want to connect to RDS
const certArn = 'arn:aws:acm:region:account_id:certificate/cerificate_id';
const myIP = '24.133.236.1/32';
const domainName = 'spring.commencis-cloud.com';
const certArn = 'arn:aws:acm:eu-west-1:461902953491:certificate/df046d09-1f1c-4979-b619-4be512876959';
const hostedZoneId = 'Z05804773E1Y13CUEI66N';
const instanceIdentifier = 'spring';
const rdsSecretName = 'pipeline/rds';
const owner = 'umutykaya';
const repo = 'spring-boot-react';
const branch = 'master';
const ghbSecretName = 'pipeline/secret';
const clusterName = 'spring-cluster';
const serviceName = 'spring-service';

export class CDKSpringPipeline extends cdk.Stack {
projectName: string = 'cdk-spring-pipeline';
Expand Down Expand Up @@ -58,7 +66,7 @@ export class CDKSpringPipeline extends cdk.Stack {
const rdsInstance = new rds.DatabaseInstance(this, 'InstanceWithUsername', {
engine,
vpc,
databaseName: 'spring',
instanceIdentifier,
securityGroups: [DBGroup],
removalPolicy: cdk.RemovalPolicy.DESTROY,
deletionProtection: false,
Expand Down Expand Up @@ -98,12 +106,12 @@ export class CDKSpringPipeline extends cdk.Stack {
});

const hostedZone = route53.HostedZone.fromHostedZoneAttributes(this, 'hostedZone', {
hostedZoneId: 'Z0309870FZYTOAVNETRD',
zoneName: 'umutykaya.com'
hostedZoneId,
zoneName: 'commencis-cloud.com'
})

const cluster = new ecs.Cluster(this, "cluster", {
clusterName: 'spring-boot-service',
clusterName,
vpc: vpc,
containerInsights: true,
});
Expand Down Expand Up @@ -155,13 +163,13 @@ export class CDKSpringPipeline extends cdk.Stack {


const fargateService = new ecs_patterns.ApplicationLoadBalancedFargateService(this, "fargateService", {
serviceName: 'spring-boot-service',
serviceName,
loadBalancer: loadBalancer,
cluster: cluster,
securityGroups: [serviceToDBGroup],
taskDefinition: taskDef,
domainZone: hostedZone,
domainName: 'spring.umutykaya.com',
domainName,
// redirectHTTP: true,
minHealthyPercent: 100,
// certificate: certificate,
Expand All @@ -185,13 +193,13 @@ export class CDKSpringPipeline extends cdk.Stack {
// ECR - repo
const ecrRepo = new ecr.Repository(this, 'EcrRepo', {
imageScanOnPush: true,
repositoryName: 'spring-boot-service',
repositoryName: 'spring-boot-react',
removalPolicy: cdk.RemovalPolicy.DESTROY
});

const gitHubSource = codebuild.Source.gitHub({
owner: 'umutykaya',
repo: 'spring-boot-service',
owner,
repo,
});


Expand Down Expand Up @@ -282,9 +290,9 @@ export class CDKSpringPipeline extends cdk.Stack {
actions: [
new codepipelineactions.GitHubSourceAction({
actionName: 'GitHub_Source',
owner: 'umutykaya',
repo: 'spring-boot-react',
branch: 'develop',
owner,
repo,
branch,
oauthToken: cdk.SecretValue.secretsManager(ghbSecretName),
output: sourceOutput
}),
Expand Down

0 comments on commit f1038b1

Please sign in to comment.