#!/usr/bin/env bash

# Installs and runs localstack

# install LocalStack cli and awslocal
pip install localstack pyOpenSSL awscli-local[ver1] --upgrade
# install CDK Local
npm install -g aws-cdk-local aws-cdk
# Make sure to pull the latest version of the image
docker pull localstack/localstack
# Start LocalStack in the background
localstack start -d
# Wait 30 seconds for the LocalStack container to become ready before timing out
echo "Waiting for LocalStack startup..."
localstack wait -t 30
echo "Startup complete"
echo "Bootstrapping CDK..."
# Bootstrap CDK
cdklocal bootstrap aws://000000000000/us-east-1
