Skip to content

Periodically buy cryptocurrencies (Dollar Cost Average) in BitStamp using AWS Lambda scheduled events

License

Notifications You must be signed in to change notification settings

sscarduzio/CryptoLambda

Repository files navigation

Twitter Follow

CryptoLambda

This is a Serverless app (for AWS Lambda) that runs periodically every day and buys ETH and BTC from bitstamp. The credentials are encrypted using AWS Key Management Service (KMS).

Credentials encryption

We will use the encryption/decryption API of AWS KMS to generate a file containing the encrypted version of our Bitstamp credentials.

After you installed Serverless framework, and cloned the project, proceed with the following steps.

  1. You need to create a KMS key in AWS console (look under IAM)
  2. Copy the KMS key ARN identifier (something like: arn:aws:kms:eu-west-1:123456789012:key/xxxxxxxxxxx-xxxx-xxxxxxxxxxxx)
  3. Copy the ARN in serverless.yml
  4. Create a string with your Bitstamp API credentials, in this form: client_id,key,secret
  5. Encrypt the string using aws command line, or this simple npm based tool called kms-cli
  6. Dump the encrypted string to a file called encrypted-secret in the main dir
  7. Configure the amounts to buy daily and your base FIAT currency in the serverless.yml
  8. Everything is ready, serverless deploy -v

You can now test the lambda function from AWS Console, if it all works, tonight at midnight you'll have some crypto in your Bitstamp balance :)

Releases

No releases published

Packages

No packages published