Skip to content

Commit bfe5efd

Browse files
authored
Feat/including certificate (#3)
* Refactor: update solution name to 'prebid-server-deployment-on-aws' across multiple files * Feat: add CloudFront and DataSync configurations with conditional settings * Feat: update CloudFront configuration with new domain name and SSL certificate * Feat: add AWS CDK deployment workflow for pull requests
1 parent 13d7650 commit bfe5efd

File tree

11 files changed

+83
-12
lines changed

11 files changed

+83
-12
lines changed

.github/workflows/infra-deployment.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ jobs:
5959
run: |
6060
. $VENV
6161
cd infrastructure
62-
cdk bootstrap --cloudformation-execution-policies arn:aws:iam::aws:policy/AdministratorAccess
6362
cdk synth
6463
6564
- name: Deploy

.github/workflows/infra-pr.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: AWS CDK PR
2+
3+
on:
4+
pull_request:
5+
branches: [longitude]
6+
7+
permissions:
8+
contents: read
9+
10+
concurrency:
11+
group: ci-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
pr-test:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Check out code
20+
uses: actions/checkout@v4
21+
22+
- name: Configure AWS credentials
23+
uses: aws-actions/configure-aws-credentials@v4
24+
with:
25+
aws-region: ${{ secrets.AWS_REGION }}
26+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
27+
aws-secret-access-key: ${{ secrets.AWS_ACCESS_SECRET }}
28+
aws-session-token: ${{ secrets.AWS_ACCESS_TOKEN }}
29+
30+
- name: Set up Python
31+
uses: actions/setup-python@v5
32+
with:
33+
python-version: "3.13"
34+
35+
- name: Set up Node
36+
uses: actions/setup-node@v4
37+
with:
38+
node-version: "20"
39+
40+
- name: Install and configure Poetry
41+
uses: snok/install-poetry@v1
42+
with:
43+
virtualenvs-create: true
44+
virtualenvs-in-project: true
45+
installer-parallel: true
46+
47+
- name: Install Dependencies
48+
working-directory: ./source
49+
run: |
50+
npm install -g aws-cdk
51+
poetry install
52+
53+
- name: Run tests
54+
working-directory: ./deployment
55+
run: bash ./run-unit-tests.sh --in-venv 1
56+
57+
- name: Build
58+
working-directory: ./source
59+
run: |
60+
. $VENV
61+
cd infrastructure
62+
cdk synth

solution-manifest.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
id: SO0248
2-
name: longitude-s2s
2+
name: prebid-server-deployment-on-aws
33
version: v1.1.1
44
cloudformation_templates:
55
- template: prebid-server-deployment-on-aws.template

source/infrastructure/cdk.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"aws-cn"
2929
],
3030
"@aws-cdk/aws-s3:serverAccessLogsUseBucketPolicy": true,
31-
"SOLUTION_NAME": "longitude-s2s",
31+
"SOLUTION_NAME": "Prebid Server Deployment on AWS",
3232
"SOLUTION_ID": "SO0248",
3333
"SOLUTION_VERSION": "v1.1.1",
3434
"METRICS_NAMESPACE": "prebid-server-deployment-on-aws-metrics",

source/infrastructure/prebid_server/cloudfront_waf_construct.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
aws_kms as kms,
88
aws_s3 as s3,
99
aws_cloudfront_origins as cloudfront_origins,
10-
aws_iam as iam
10+
aws_iam as iam,
11+
aws_certificatemanager as certificatemanager
1112
)
1213

1314
from aws_cdk import Aws, CustomResource, Duration, RemovalPolicy
@@ -258,6 +259,8 @@ def __init__(
258259
default_behavior=default_behavior,
259260
web_acl_id=waf_webacl_arn,
260261
enable_logging=True,
262+
domain_names=globals.DOMAIN_NAMES,
263+
certificate=certificatemanager.Certificate.from_certificate_arn(self, "sslCertificate", globals.SSL_CERTIFICATE_ARN),
261264
log_bucket=cloudfront_access_logs_bucket,
262265
)
263266

source/infrastructure/prebid_server/prebid_datasync_constructs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,8 @@ def __init__(
590590
destination_location_arn=self.s3_location.s3_location.attr_location_arn,
591591
source_location_arn=self.efs_location.efs_location.attr_location_arn,
592592
schedule=datasync.CfnTask.TaskScheduleProperty(
593-
schedule_expression=self.task_schedule
593+
schedule_expression=self.task_schedule,
594+
status="DISABLED" if globals.DATASYNC_DISABLE else "ENABLED",
594595
),
595596
options=datasync.CfnTask.OptionsProperty(
596597
transfer_mode="CHANGED",

source/infrastructure/prebid_server/prebid_server_stack.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from .prebid_glue_constructs import GlueEtl
2424
from .cloudtrail_construct import CloudTrailConstruct
2525

26+
import prebid_server.stack_constants as globals
2627

2728
class PrebidServerStack(SolutionStack):
2829
name = "longitude-s2s"
@@ -47,7 +48,7 @@ def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
4748
id="SSLCertificateARN",
4849
description="The ARN of an SSL certificate in AWS Certificate Manager associated with a domain name. This field is only required if InstallCloudFrontAndWAF is set to \"No\".",
4950
type="String",
50-
default=""
51+
default=globals.SSL_CERTIFICATE_ARN,
5152
)
5253
self.solutions_template_options.add_parameter(deploy_cloudfront_and_waf_param, label="",
5354
group="Content Delivery Network (CDN) Settings")

source/infrastructure/prebid_server/stack_constants.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
FARGATE_MAX_HEALTHY_PERCENT = 200
4444
HEALTH_CHECK_GRACE_PERIOD = 120
4545

46+
DATASYNC_DISABLE=True
4647
DATASYNC_METRICS_SCHEDULE = "cron(30 * * * ? *)" # hourly on the half hour
4748
DATASYNC_LOGS_SCHEDULE = "cron(30 * * * ? *)" # hourly on the half hour
4849
DATASYNC_REPORT_LIFECYCLE_DAYS = 1
@@ -62,3 +63,7 @@
6263

6364
CLOUD_FRONT_NAMESPACE = "AWS/CloudFront"
6465
RESOURCE_NAMESPACE = "aws:ResourceAccount"
66+
67+
# CloudFront settings
68+
SSL_CERTIFICATE_ARN = "arn:aws:acm:us-east-1:463470947511:certificate/e5848f93-debb-473d-a307-97b8d1fabe75"
69+
DOMAIN_NAMES = ["s2s.lngtd.com"]

source/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tool.poetry]
2-
name = "longitude-s2s"
2+
name = "prebid-server-deployment-on-aws"
33
version = "1.1.1"
44
description = "Prebid Server Deployment on AWS - Easily deploy and operate a scalable Prebid Server for programmatic advertising auctions"
55
license = "MIT"

source/tests/unit_tests/test_app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ def build_app_fix():
5050
]
5151
)
5252
def test_build_app(build_app_fix):
53-
app_stack = build_app_fix.get_stack_by_name("prebid-server-deployment-on-aws")
53+
app_stack = build_app_fix.get_stack_by_name("longitude-s2s")
5454
assert app_stack is not None
55-
assert app_stack.stack_name == "prebid-server-deployment-on-aws"
55+
assert app_stack.stack_name == "longitude-s2s"
5656
assert app_stack.template is not None
5757
assert app_stack.template["Description"] == "(SO9999test) - Prebid Server Deployment on AWS. Version v99.99.99"

0 commit comments

Comments
 (0)