Illustration Image

Cassandra.Link

The best knowledge base on Apache Cassandra®

Helping platform leaders, architects, engineers, and operators build scalable real time data platforms.

7/15/2020

Reading time:3 min

JamesWoolfenden/terraform-aws-cassandra

by JamesWoolfenden

A project to set up infrastructure in AWS for an Apache Cassandra cluster, thia module will create Cassandra on Ec2 and autocluster the nodes.It's 100% Open Source and licensed under the APACHE2.UsageThe folder example/examplea contains a complete sample illustration of how to use this module.├───examplea│ data.tf│ examplea.auto.tfvars│ Makefile│ module.cassandra.tf│ outputs.tf│ provider.aws.tf│ variables.tfAs a minimum you must include a module reference in your own template Terraform code e.g. module.cassandra.tf:module "cassandra" { source = "../../" instance_type = var.instance_type common_tags = var.common_tags subnet_ids = data.aws_subnet_ids.subs.ids #add the private ips private_ips = [] allowed_ranges = [module.myip.cidr] ssh-inbound-range = [module.myip.cidr] ami = local.ami vpc_id = tolist(data.aws_vpcs.main.ids)[0]}You will also need to define variables variables.tf and supply values examplea.auto.tfvars.You'll need to adjust the values to your own.You will also need build a Cassandra AMI, see the Packer folder for that template.If you want to test the modules usage execute Terraform in the examplea folder:cd example/examplea✔ /mnt/c/code/slalom/aws/terraform-aws-cassandra/example/examplea [master|✚ 1⚑ 1]09:56 $ make initrm -rf .terraform/terraform init -reconfigureInitializing modules...- cassandra in ../..Downloading jameswoolfenden/ip/http 0.2.7 for myip...- myip in .terraform/modules/myip/terraform-http-ip-0.2.7Initializing the backend...Initializing provider plugins...- Checking for available provider plugins...- Downloading plugin for provider "aws" (hashicorp/aws) 2.54.0...Terraform has been successfully initialized!You may now begin working with Terraform. Try running "terraform plan" to seeany changes that are required for your infrastructure. All Terraform commandsshould now work.If you ever set or change modules or backend configuration for Terraform,rerun this command to reinitialize your working directory. If you forget, othercommands will detect it and remind you to do so if necessary.terraform apply....ProvidersNameVersionawsn/aInputsNameDescriptionTypeDefaultRequiredallowed_rangesAllowed ranges that can access the clusterlist["0.0.0.0/0"]noamiContains information to select desired AMImapn/ayescommon_tagsImplements the common tags schememap(string)n/ayesconfig-filen/astring"/etc/dse/cassandra/cassandra.yaml"noinstance_typeaws instance type and classstringn/ayesprivate_ipsList of ips for the cassandra nodeslistn/ayesssh-inbound-rangeCIDRs of address that are allowed to ssh in.list["0.0.0.0/0"]nosubnet_idsList of subnet Idslistn/ayestemplate-filen/astring"cassandra.tmpl"novpc_idn/astringn/ayesOutputsNameDescriptioninstancesn/asecurity_groupn/aRelated ProjectsCheck out these related projects.HelpGot a question?File a GitHub issue.ContributingBug Reports & Feature RequestsPlease use the issue tracker to report any bugs or file feature requests.CopyrightsCopyright © 2019-2020 Slalom, LLCLicenseSee LICENSE for full details.Licensed to the Apache Software Foundation (ASF) under oneor more contributor license agreements. See the NOTICE filedistributed with this work for additional informationregarding copyright ownership. The ASF licenses this fileto you under the Apache License, Version 2.0 (the"License"); you may not use this file except in compliancewith the License. You may obtain a copy of the License athttps://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing,software distributed under the License is distributed on an"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANYKIND, either express or implied. See the License for thespecific language governing permissions and limitationsunder the License.ContributorsJames Woolfenden

Illustration Image

Slalom

Build Status Latest Release pre-commit pre-commit

A project to set up infrastructure in AWS for an Apache Cassandra cluster, thia module will create Cassandra on Ec2 and autocluster the nodes.


alt text It's 100% Open Source and licensed under the APACHE2.

Usage

The folder example/examplea contains a complete sample illustration of how to use this module.

├───examplea
│       data.tf
│       examplea.auto.tfvars
│       Makefile
│       module.cassandra.tf
│       outputs.tf
│       provider.aws.tf
│       variables.tf

As a minimum you must include a module reference in your own template Terraform code e.g. module.cassandra.tf:

module "cassandra" {
  source        = "../../"
  instance_type = var.instance_type
  common_tags   = var.common_tags
  subnet_ids    = data.aws_subnet_ids.subs.ids
  #add the private ips
  private_ips       = []
  allowed_ranges    = [module.myip.cidr]
  ssh-inbound-range = [module.myip.cidr]
  ami               = local.ami
  vpc_id            = tolist(data.aws_vpcs.main.ids)[0]
}

You will also need to define variables variables.tf and supply values examplea.auto.tfvars. You'll need to adjust the values to your own. You will also need build a Cassandra AMI, see the Packer folder for that template. If you want to test the modules usage execute Terraform in the examplea folder:

cd example/examplea
✔ /mnt/c/code/slalom/aws/terraform-aws-cassandra/example/examplea [master|✚ 1⚑ 1]
09:56 $ make init
rm -rf .terraform/
terraform init -reconfigure
Initializing modules...
- cassandra in ../..
Downloading jameswoolfenden/ip/http 0.2.7 for myip...
- myip in .terraform/modules/myip/terraform-http-ip-0.2.7
Initializing the backend...
Initializing provider plugins...
- Checking for available provider plugins...
- Downloading plugin for provider "aws" (hashicorp/aws) 2.54.0...
Terraform has been successfully initialized!
You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.
If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
terraform apply
....

Providers

Name Version
aws n/a

Inputs

Name Description Type Default Required
allowed_ranges Allowed ranges that can access the cluster list
[
"0.0.0.0/0"
]
no
ami Contains information to select desired AMI map n/a yes
common_tags Implements the common tags scheme map(string) n/a yes
config-file n/a string "/etc/dse/cassandra/cassandra.yaml" no
instance_type aws instance type and class string n/a yes
private_ips List of ips for the cassandra nodes list n/a yes
ssh-inbound-range CIDRs of address that are allowed to ssh in. list
[
"0.0.0.0/0"
]
no
subnet_ids List of subnet Ids list n/a yes
template-file n/a string "cassandra.tmpl" no
vpc_id n/a string n/a yes

Outputs

Name Description
instances n/a
security_group n/a

Related Projects

Check out these related projects.

Help

Got a question?

File a GitHub issue.

Contributing

Bug Reports & Feature Requests

Please use the issue tracker to report any bugs or file feature requests.

Copyrights

Copyright © 2019-2020 Slalom, LLC

License

License

See LICENSE for full details.

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Contributors

James Woolfenden
James Woolfenden

Related Articles

database
datastax
aws

Getting Started with DataStax Astra DB and Amazon Bedrock | DataStax

John Doe

11/30/2023

Checkout Planet Cassandra

Claim Your Free Planet Cassandra Contributor T-shirt!

Make your contribution and score a FREE Planet Cassandra Contributor T-Shirt! 
We value our incredible Cassandra community, and we want to express our gratitude by sending an exclusive Planet Cassandra Contributor T-Shirt you can wear with pride.

Join Our Newsletter!

Sign up below to receive email updates and see what's going on with our company

Explore Related Topics

AllKafkaSparkScyllaSStableKubernetesApiGithubGraphQl

Explore Further

aws