Skip to content

Commit

Permalink
Merge pull request #130 from ncx-co/db-instance-size
Browse files Browse the repository at this point in the history
add a config parameter for db instance size
  • Loading branch information
vincentsarago authored Aug 24, 2023
2 parents 7f9ee49 + 4902447 commit a2d4582
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions docs/src/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ The example commands here will deploy a CloudFormation stack called `eoAPI-stagi

Set environment variable or hard code in `infrastructure/aws/.env` file (e.g `CDK_EOAPI_DB_PGSTAC_VERSION=0.7.1`).

To modify the size of the burstable database instance, modify `CDK_EOAPI_DB_INSTANCE_SIZE` to one of the values of [`aws_cdk.aws_ec2.InstanceSize`](https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_ec2/InstanceSize.html#instancesize).
The default size is `SMALL`.

**Important**:

- `CDK_EOAPI_DB_PGSTAC_VERSION` is a required env (see https://github.com/stac-utils/pgstac/tags for the latest version)
Expand Down
3 changes: 2 additions & 1 deletion infrastructure/aws/cdk/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ def __init__( # noqa: C901
vpc=vpc,
engine=rds.DatabaseInstanceEngine.POSTGRES,
instance_type=ec2.InstanceType.of(
ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.SMALL
ec2.InstanceClass.BURSTABLE3,
ec2.InstanceSize(eodb_settings.instance_size),
),
database_name="postgres",
vpc_subnets=ec2.SubnetSelection(subnet_type=ec2.SubnetType.PUBLIC),
Expand Down
1 change: 1 addition & 0 deletions infrastructure/aws/cdk/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class eoDBSettings(pydantic.BaseSettings):

# Define PGSTAC VERSION
pgstac_version: str
instance_size: str = "SMALL"
context: bool = True
mosaic_index: bool = True

Expand Down

0 comments on commit a2d4582

Please sign in to comment.