Skip to content

Commit

Permalink
aws cdk
Browse files Browse the repository at this point in the history
  • Loading branch information
jimomulloy committed Mar 16, 2023
1 parent 0f23e8c commit 1c17bcd
Show file tree
Hide file tree
Showing 21,799 changed files with 3,111,669 additions and 586 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
41 changes: 41 additions & 0 deletions LambdaAlbStack.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package airhacks.alb.boundary;

import java.util.List;

import airhacks.alb.control.Alb;
import airhacks.alb.control.PublicVPC;
import airhacks.lambda.control.QuarkusLambda;
import software.amazon.awscdk.CfnOutput;
import software.amazon.awscdk.Stack;
import software.amazon.awscdk.services.elasticloadbalancingv2.AddApplicationTargetsProps;
import software.amazon.awscdk.services.elasticloadbalancingv2.BaseApplicationListenerProps;
import software.amazon.awscdk.services.elasticloadbalancingv2.HealthCheck;
import software.amazon.awscdk.services.elasticloadbalancingv2.targets.LambdaTarget;
import software.constructs.Construct;

public class LambdaAlbStack extends Stack {

static String FUNCTION_NAME = "airhacks_lambda_gretings_boundary_Greetings";

public LambdaAlbStack(Construct scope, String id) {
super(scope, id + "-alb-stack");

var quarkuLambda = new QuarkusLambda(this, FUNCTION_NAME);
var publicVPCConstruct = new PublicVPC(this);
var publicVPC = publicVPCConstruct.getVpc();
var alb = new Alb(this, publicVPC, "AirhacksLambdaLB");

var function = quarkuLambda.getFunction();
var lambdaTarget = new LambdaTarget(function);

var loadBalancer = alb.getApplicationLoadBalancer();
var listener = loadBalancer.addListener("Http", BaseApplicationListenerProps.builder().port(80).build());

listener.addTargets("Lambda", AddApplicationTargetsProps.builder().targets(List.of(lambdaTarget))
.healthCheck(HealthCheck.builder().enabled(true).build()).build());
CfnOutput.Builder.create(this, "FunctionARN").value(function.getFunctionArn()).build();
var url = loadBalancer.getLoadBalancerDnsName();
CfnOutput.Builder.create(this, "LoadBalancerDNSName").value(url).build();
CfnOutput.Builder.create(this, "LoadBalancerCurlOutput").value("curl -i http://" + url + "/hello").build();
}
}
2 changes: 2 additions & 0 deletions instrument-aws/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/bin/
cdk.out/
4 changes: 2 additions & 2 deletions instrument-aws/buildAndDeploy.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
set -e
echo "building functions"
cd lambda && mvn clean package
cd instrument-lambda && mvn clean package
echo "building CDK"
cd ../cdk && mvn clean package && cdk deploy
cd ../instrument-cdk && mvn clean package && cdk deploy
4 changes: 2 additions & 2 deletions instrument-aws/buildAndDeployDontAsk.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
set -e
echo "building functions"
cd lambda && mvn clean package
cd instrument-lambda && mvn clean package
echo "building CDK"
cd ../cdk && mvn clean package && cdk deploy --all --require-approval=never
cd ../instrument-cdk && mvn clean package && cdk deploy --all --require-approval=never
6 changes: 3 additions & 3 deletions instrument-aws/buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ phases:
build:
commands:
- echo "building AWS Lambda"
- cd ${CODEBUILD_SRC_DIR}/lambda && mvn --no-transfer-progress -DskipTests package
- cd ${CODEBUILD_SRC_DIR}/instrument-lambda && mvn --no-transfer-progress -DskipTests package
- echo "building cdk"
- cd ${CODEBUILD_SRC_DIR}/cdk && mvn --no-transfer-progress -DskipTests package
- cd ${CODEBUILD_SRC_DIR}/instrument-cdk && mvn --no-transfer-progress -DskipTests package
- echo "deploying application"
- cd ${CODEBUILD_SRC_DIR}/cdk && cdk deploy --all --require-approval=never
- cd ${CODEBUILD_SRC_DIR}/instrument-cdk && cdk deploy --all --require-approval=never
16 changes: 0 additions & 16 deletions instrument-aws/cdk/cdk.json

This file was deleted.

72 changes: 0 additions & 72 deletions instrument-aws/cdk/pom.xml

This file was deleted.

45 changes: 0 additions & 45 deletions instrument-aws/cdk/src/main/java/airhacks/CDKApp.java

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 1c17bcd

Please sign in to comment.