Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/radzionc/terraform-aws-documentdb-lambda

Terraform module which creates Amazon DocumentDB and AWS Lambda in same VPC
https://github.com/radzionc/terraform-aws-documentdb-lambda

api-gateway aws aws-lambda documentdb mongodb nodejs terraform terraform-module

Last synced: 2 months ago
JSON representation

Terraform module which creates Amazon DocumentDB and AWS Lambda in same VPC

Awesome Lists containing this project

README

        

# [terraform-aws-documentdb-lambda](https://medium.com/p/34a5d1061c15)

>
## create resources on AWS:
```bash
#
$ export AWS_ACCESS_KEY_ID=
$ export AWS_SECRET_ACCESS_KEY=

# set variable as env vars or in vars.tf file
$ export TF_VAR_name= # by default geek_api
$ export TF_VAR_docdb_password=
# if you have a domain on AWS
# lambda will be available at https://.
$ export TF_VAR_certificate_arn=
$ export TF_VAR_zone_id=Z1NT1BON8JUIVM=
$ export TF_VAR_main_domain=

$ terraform init
$ terraform apply
```

## Outputs:
- aws_instance_public_dns
- url
- docdb_endpoint
- docdb_username
- bucket
- bucket_key
- name

## Connect to Amazon DocumentDB
```bash
$ ssh -i tf--ec2 ubuntu
$ mongo \
--host \
--username \
--password
```

## update function code:
```bash
$ export AWS_DEFAULT_REGION=
$ aws s3 cp lambda.zip s3:///
$ aws lambda update-function-code --function-name tf- --s3-bucket --s3-key
```

## [Blog post](https://geekrodion.com/blog/documentdb-terraform)

## License

MIT © [RodionChachura](https://geekrodion.com)