Since one week, AWS released Managed Apache Cassandra service in a couple of regions: https://aws.amazon.com/mcs/. Obviously, I can't find anything in the Terraform docs, so I'm assuming that this still needs to be implemented. If this is the case, I would like to contribute. Please have a look at the potential Terraform configuration below.
I'm not sure which existing resources are affected by this but new resources could be named:
"aws_mcs_keyspace" "example" {
name = "mcs-keyspace-example"
exists = "true"
region = "eu-north-1"
replication {
class = "SingleRegionStrategy"
}
}
"aws_mcs_table" "example" {
name = "mcs-table-example"
keyspace_arn = "${aws_mcs_keyspace.example.arn}"
exists = "true"
fields {
columns {
name = "name",
type = "text",
}
columns {
name = "email",
type = "text",
}
}
primary_key = ["email", "name"]
# clustering key?
}
Hi @markvdlaan93 馃憢 Thank you for submitting this.
At this current time, AWS has not released an API or SDK for this new service:
Without these, we cannot implement support for this AWS service in Terraform. Please reach out to AWS Support or your account managers to ask about API support.
Hi Everyone !
I am also looking for terraform documentation for setting up mcs. Please let us know if we have any
Thanks,
Anurag
Amazon Keyspaces (for Apache Cassandra) is now generally available:
No support in the AWS SDK yet though.
It appears some sort of integration with an IAM user might be necessary since that's where one would create a Cassandra credential that's used by clients to connect.
Hey all,
I was battling with this today and wanted to share my solution in case it's helpful for anyone else. I ended up using CloudFormation _via_ Terraform as follows to create a keyspace and a table:
main.tf
provider "aws" {
region = "eu-central-1"
version = "~> 3.0"
}
resource "aws_cloudformation_stack" "keyspaces" {
name = "my-keyspace"
template_body = file("./keyspace.yaml")
}
keyspace.yaml
AWSTemplateFormatVersion: 2010-09-09
Resources:
MyKeyspace:
Type: AWS::Cassandra::Keyspace
Properties:
KeyspaceName: abc
MyTable:
Type: AWS::Cassandra::Table
DependsOn: MyKeyspace
Properties:
KeyspaceName: abc
TableName: my_table
PartitionKeyColumns:
- ColumnName: id
ColumnType: TEXT
BillingMode:
Mode: ON_DEMAND
NOTE: Column changes aren't currently supported by CloudFormation, so once your table has been created, you can't change it with Terraform/CloudFormation.
Most helpful comment
Amazon Keyspaces (for Apache Cassandra) is now generally available:
No support in the AWS SDK yet though.