Skip to content

AWS Cloud Formation Template generator

Notifications You must be signed in to change notification settings

bitcoin-sv/spv-wallet-aws

Repository files navigation

Enviroments

Environment configuration for test and prod are kept in the config folder.

Config file structure

# Bucket to store the template file
template_bucket_name: spv-wallet-test-template  

# Prefix for specific region asset bucket
file_asset_bucket_name_prefix: spv-wallet-test-marketplace-assets 

# AWS Regions set
file_asset_region_set:
  - 'eu-central-1'
  - 'us-east-1'
  - 'eu-north-1'

# Prefix for files in all buckets
file_asset_prefix: spv-wallet/latest/ 

Development environment setup

AWS Client Setup and credentials configuration

# download AWS client installer
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip

#install AWS client
sudo ./aws/install

# configure credentials
aws configure

CDK setup for Python

# install cdk cli with specific version
npm install [email protected] 
npm install [email protected] 

# Install Python dependencies (in case of using a virtual environment active it first)
python -m pip install -r requirements.txt

Code release

  1. Before you start setup your environment as described in the Development environment setup section.
  2. Ensure that your AWS credentials are configured and are connected with proper account.
  3. Use update.sh script to deploy the template to the AWS s3.
./update.sh {environment}

Where {environment} is the name of the environment you want to deploy (dev or test or prod).

example:

./update.sh prod

By default, the script will deploy the template to the test environment.

  1. Commit changes made by the script.

Additional information:

  • the script first will check if there is newer version of helm chart and if so, then it will be updated in {environment}.yaml file
  • then it will prepare the template
  • then it will upload it to the spv-wallet/new folder in the bucket
  • after that, it will move the template from the spv-wallet/latest to the spv-wallet/old folder
  • and finally, it will move the template from the spv-wallet/new to the spv-wallet/latest folder

URL's to deploy environment

Production version:

Region CloudFormation template link
AP ap-south-1, ap-northeast-1, ap-northeast-2, ap-northeast-3, ap-southeast-1, ap-southeast-2
CA ca-central-1
EU eu-central-1, eu-west-1, eu-west-2, eu-west-3, eu-north-1
SA sa-east-1
US us-east-1, us-east-2, us-west-1, us-west-2

Test version:

Region CloudFormation template link
AP ap-south-1, ap-northeast-1, ap-northeast-2, ap-northeast-3, ap-southeast-1, ap-southeast-2
CA ca-central-1
EU eu-central-1, eu-west-1, eu-west-2, eu-west-3, eu-north-1
SA sa-east-1
US us-east-1, us-east-2, us-west-1, us-west-2

Dev version:

Region CloudFormation template link
EU eu-central-1, eu-north-1
US us-east-1

Kubernetes version update

In cluster.py update:

  • Kubernetes version property in cluster construct (ex. _eks.KubernetesVersion.V1_29). Make sure that CDK versio©†n in the requirements supporting specific Kubernetes version, if needed update CDK version. Information can be found at https://github.com/aws/aws-cdk/releases
  • Cluster nodes image release version property in node group construct (ex. release_version="1.29.0-20240202") EKS nodes images release version can be found at https://github.com/awslabs/amazon-eks-ami/releases
  • Kubernetes lambda layer to the same version as Kubernetes cluster. Lambda Layer requires an update within requirements.