Skip to content

Commit

Permalink
fix(infra): Fix the cog batch job to put record to dynamodb. (#2197)
Browse files Browse the repository at this point in the history
* Fix the cog batch job to put record to dynamodb.

* Revert the dynamodb arn region setting.

* Hard code region for DynamoDB
  • Loading branch information
Wentao-Kuang authored May 17, 2022
1 parent 5c3bdd8 commit 3c89246
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion packages/_infra/src/cogify/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { createHash } from 'crypto';
import { TileMetadataTableArn } from '../serve/db.js';
import { ScratchData } from './mount.folder.js';
import { Construct } from 'constructs';
import { getConfig } from '../config.js';

/**
* Cogification infrastructure
Expand Down Expand Up @@ -126,6 +127,8 @@ export class CogBuilderStack extends cdk.Stack {
},
});

const config = getConfig();

new batch.CfnJobDefinition(this, 'CogBatchJobDef', {
jobDefinitionName: 'CogBatchJob',
type: 'container',
Expand All @@ -145,7 +148,7 @@ export class CogBuilderStack extends cdk.Stack {
* Eg a instance with 8192MB allocates 7953MB usable
*/
memory: 3900,
environment: [{ name: Env.TempFolder, value: ScratchData.Folder }],
environment: [{ name: Env.TempFolder, value: ScratchData.Folder, [Env.PublicUrlBase]: config.PublicUrlBase }],
mountPoints: [{ containerPath: ScratchData.Folder, sourceVolume: 'scratch' }],
volumes: [{ name: 'scratch', host: { sourcePath: ScratchData.Folder } }],
},
Expand Down
2 changes: 1 addition & 1 deletion packages/config/src/dynamo/dynamo.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class ConfigProviderDynamo extends BasemapsConfigProvider {

constructor(tableName: string) {
super();
this.dynamo = new DynamoDB({});
this.dynamo = new DynamoDB({ region: 'ap-southeast-2' });
this.tableName = tableName;
}

Expand Down

0 comments on commit 3c89246

Please sign in to comment.