Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sdlf-dataset][cdk] add peh, manifests tables #414

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 129 additions & 0 deletions sdlf-dataset/src/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from aws_cdk import (
CfnOutput,
CfnParameter,
aws_dynamodb as ddb,
aws_glue as glue,
aws_glue_alpha as glue_a,
aws_lakeformation as lakeformation,
Expand Down Expand Up @@ -173,6 +174,134 @@ def __init__(self, scope: Construct, id: str, **kwargs) -> None:
string_value=p_pipelinedetails.value_as_string, # bit of a hack for datasets lambda
)

peh_table = ddb.Table(
self,
"rDynamoOctagonExecutionHistory",
removal_policy=RemovalPolicy.DESTROY,
partition_key=ddb.Attribute(
name="id",
type=ddb.AttributeType.STRING,
),
billing_mode=ddb.BillingMode.PAY_PER_REQUEST,
table_name=f"octagon-PipelineExecutionHistory-{p_environment.value_as_string}",
encryption=ddb.TableEncryption.CUSTOMER_MANAGED,
encryption_key=kms_key,
point_in_time_recovery=True,
time_to_live_attribute="ttl",
)
peh_table.add_global_secondary_index(
index_name="pipeline-last-updated-index",
partition_key=ddb.Attribute(
name="pipeline",
type=ddb.AttributeType.STRING,
),
sort_key=ddb.Attribute(
name="last_updated_timestamp",
type=ddb.AttributeType.STRING,
),
projection_type=ddb.ProjectionType.ALL,
)
peh_table.add_global_secondary_index(
index_name="execution_date-status-index",
partition_key=ddb.Attribute(
name="execution_date",
type=ddb.AttributeType.STRING,
),
sort_key=ddb.Attribute(
name="status",
type=ddb.AttributeType.STRING,
),
projection_type=ddb.ProjectionType.ALL,
)
peh_table.add_global_secondary_index(
index_name="pipeline-execution_date-index",
partition_key=ddb.Attribute(
name="pipeline",
type=ddb.AttributeType.STRING,
),
sort_key=ddb.Attribute(
name="execution_date",
type=ddb.AttributeType.STRING,
),
projection_type=ddb.ProjectionType.ALL,
)
peh_table.add_global_secondary_index(
index_name="execution_date-last_updated-index",
partition_key=ddb.Attribute(
name="execution_date",
type=ddb.AttributeType.STRING,
),
sort_key=ddb.Attribute(
name="last_updated_timestamp",
type=ddb.AttributeType.STRING,
),
projection_type=ddb.ProjectionType.ALL,
)
peh_table.add_global_secondary_index(
index_name="status-last_updated-index",
partition_key=ddb.Attribute(
name="status",
type=ddb.AttributeType.STRING,
),
sort_key=ddb.Attribute(
name="last_updated_timestamp",
type=ddb.AttributeType.STRING,
),
projection_type=ddb.ProjectionType.ALL,
)
peh_table.add_global_secondary_index(
index_name="pipeline-status_last_updated-index",
partition_key=ddb.Attribute(
name="pipeline",
type=ddb.AttributeType.STRING,
),
sort_key=ddb.Attribute(
name="status_last_updated_timestamp",
type=ddb.AttributeType.STRING,
),
projection_type=ddb.ProjectionType.ALL,
)
peh_table.add_global_secondary_index(
index_name="dataset-status_last_updated_timestamp-index",
partition_key=ddb.Attribute(
name="dataset",
type=ddb.AttributeType.STRING,
),
sort_key=ddb.Attribute(
name="status_last_updated_timestamp",
type=ddb.AttributeType.STRING,
),
projection_type=ddb.ProjectionType.ALL,
)

manifests_table = ddb.Table(
self,
"rDynamoOctagonManifests",
removal_policy=RemovalPolicy.DESTROY,
partition_key=ddb.Attribute(
name="dataset_name",
type=ddb.AttributeType.STRING,
),
sort_key=ddb.Attribute(
name="datafile_name",
type=ddb.AttributeType.STRING,
),
billing_mode=ddb.BillingMode.PAY_PER_REQUEST,
table_name=f"octagon-Manifests-{p_environment.value_as_string}",
encryption=ddb.TableEncryption.CUSTOMER_MANAGED,
encryption_key=kms_key,
point_in_time_recovery=True,
time_to_live_attribute="ttl",
)
ssm.StringParameter(
self,
"rDynamoManifestsSsm",
description="Name of the DynamoDB used to store manifest process metadata",
parameter_name="/SDLF/Dynamo/Manifests",
string_value=manifests_table.table_name,
)


# CloudFormation Outputs TODO
CfnOutput(
self,
Expand Down
Loading