Template repository to deploy eoapi on AWS using the eoapi-cdk constructs or locally with Docker.
- uv
- docker
- nvm
- AWS credentials environment variables configured to point to an account.
- Optional a
config.yaml
file to override the default deployment settings defined inconfig.py
.
Install python dependencies with
uv sync --all-groups
And node dependencies with
nvm use
npm install
Verify that the cdk
CLI is available. Since aws-cdk
is installed as a local dependency, you can use the npx
node package runner tool, that comes with npm
.
npx cdk --version
Verify that the cdk
CLI is available. Since aws-cdk
is installed as a local dependency, you can use the npx
node package runner tool, that comes with npm
.
First, synthesize the app
uv run npx cdk synth --all
Then, deploy
uv run npx cdk deploy --all --require-approval never
PGSTAC_STACK=eoapi-fedgeoday25
PGSTAC_SECRET_ARN=$(aws cloudformation describe-stacks --stack-name $PGSTAC_STACK --query "Stacks[0].Outputs[?OutputKey=='PgstacSecret'].OutputValue" --output text)
PGSTAC_SECRET_VALUE=$(aws secretsmanager get-secret-value \
--secret-id "$PGSTAC_SECRET_ARN" \
--query "SecretString" \
--output text)
export PGHOST=$(echo "$PGSTAC_SECRET_VALUE" | jq -r '.host')
export PGPORT=$(echo "$PGSTAC_SECRET_VALUE" | jq -r '.port')
export PGDATABASE=$(echo "$PGSTAC_SECRET_VALUE" | jq -r '.dbname')
export PGUSER=$(echo "$PGSTAC_SECRET_VALUE" | jq -r '.username')
export PGPASSWORD=$(echo "$PGSTAC_SECRET_VALUE" | jq -r '.password')
psql -c "CREATE SCHEMA features;"
psql -c "DROP TABLE features.terrestrial_ecoregions;"
# download from WWF site not working with wget so download from browser...
# wget https://files.worldwildlife.org/wwfcmsprod/files/Publication/file/6kcchn7e3u_official_teow.zip -O /tmp/6kcchn7e3u_official_teow.zip
ogr2ogr -f "PostgreSQL" \
PG:"postgresql://${PGUSER}:${PGPASSWORD}@${PGHOST}:${PGPORT}/${PGDATABASE}" \
/vsizip//tmp/6kcchn7e3u_official_teow.zip/official/wwf_terr_ecos.shp \
-nln features.terrestrial_ecoregions \
-lco GEOMETRY_NAME=geom \
-lco FID=id \
-lco PRECISION=NO \
-nlt PROMOTE_TO_MULTI