https://github.com/fscm/packer-aws-cassandra
Packer Template to build a AWS Apache Cassandra AMI
https://github.com/fscm/packer-aws-cassandra
ami aws cassandra packer
Last synced: 4 months ago
JSON representation
Packer Template to build a AWS Apache Cassandra AMI
- Host: GitHub
- URL: https://github.com/fscm/packer-aws-cassandra
- Owner: fscm
- License: mit
- Created: 2017-01-22T13:24:08.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2022-01-03T16:05:43.000Z (over 4 years ago)
- Last Synced: 2025-03-26T16:11:17.640Z (about 1 year ago)
- Topics: ami, aws, cassandra, packer
- Language: Shell
- Homepage:
- Size: 39.1 KB
- Stars: 10
- Watchers: 2
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Apache Cassandra AMI
AMI that should be used to create virtual machines with Apache Cassandra
installed.
## Synopsis
This script will create an AMI with Apache Cassandra installed and with all of
the required initialization scripts.
The AMI resulting from this script should be the one used to instantiate a
Cassandra server (standalone or cluster).
## Getting Started
There are a couple of things needed for the script to work.
### Prerequisites
Packer and AWS Command Line Interface tools need to be installed on your local
computer.
To build a base image you have to know the id of the latest Debian AMI files
for the region where you wish to build the AMI.
#### Packer
Packer installation instructions can be found
[here](https://www.packer.io/docs/installation.html).
#### AWS Command Line Interface
AWS Command Line Interface installation instructions can be found [here](http://docs.aws.amazon.com/cli/latest/userguide/installing.html)
#### Debian AMI's
This AMI will be based on an official Debian AMI. The latest version of that
AMI will be used.
A list of all the Debian AMI id's can be found at the Debian official page:
[Debian official Amazon EC2 Images](https://wiki.debian.org/Cloud/AmazonEC2Image/)
### Usage
In order to create the AMI using this packer template you need to provide a
few options.
```
Usage:
packer build \
-var 'aws_access_key=AWS_ACCESS_KEY' \
-var 'aws_secret_key=' \
-var 'aws_region=' \
-var 'cassandra_version=' \
[-var 'option=value'] \
cassandra.json
```
#### Script Options
- `aws_access_key` - *[required]* The AWS access key.
- `aws_ami_name` - The AMI name (default value: "cassandra").
- `aws_ami_name_prefix` - Prefix for the AMI name (default value: "").
- `aws_instance_type` - The instance type to use for the build (default value: "t2.micro").
- `aws_region` - *[required]* The regions were the build will be performed.
- `aws_secret_key` - *[required]* The AWS secret key.
- `cassandra_version` - *[required]* Cassandra version.
- `java_build_number` - Java build number (default value: "11").
- `java_major_version` - Java major version (default value: "8").
- `java_token` - Java link token (default version: "d54c1d3a095b4ff2b6607d096fa80163").
- `java_update_version` - Java update version (default value: "131").
- `system_locale` - Locale for the system (default value: "en_US").
### Instantiate a Cluster
In order to end up with a functional Cassandra Cluster some configurations have
to be performed after instantiating the servers.
To help perform those configurations a small script is included on the AWS
image. The script is called **cassandra_config**.
#### Configuration Script
The script can and should be used to set some of the Cassandra options as well
as setting the Cassandra service to start at boot.
```
Usage: cassandra_config [options]
```
##### Options
* `-a` - Sets the auto_bootstrap option to 'on'.
* `-c ` - Sets the cluster_name option to the value given (default value is 'Cassandra Cluster').
* `-D` - Disables the Cassandra service from start at boot time.
* `-E` - Enables the Cassandra service to start at boot time.
* `-i
` - Sets the cassandra listen address (default value is '127.0.0.1').
* `-m ` - Sets Cassandra maximum heap size. Values should be provided following the same Java heap nomenclature.
* `-n ` - Sets Cassandra heap new size. Values should be provided following the same Java heap nomenclature.
* `-r` - Sets the endpoint_snitch option to 'EC2MultiRegionSnitch' (default value is 'SimpleSnitch').
* `-s ` - Sets the address of one seed node (or several seed nodes if the addressess are separated with a comma).
* `-S` - Starts the Cassandra service after performing the required configurations (if any given).
* `-t ` - Sets the number of tokens (default value is '4').
* `-W ` - Waits the specified amount of seconds before starting the Cassandra service (default value is '0').
#### Configuring a Cassandra Node
To prepare an instance to act as a Cassandra cluster node the following steps
need to be performed.
Run the configuration tool (*cassandra_config*) to configure the instance.
```
cassandra_config -E -S
```
After this steps a Cassandra node (for a single node cluster) should be running
and configured to start on server boot.
For a cluster with more than one Cassandra node other options have to be
configured on each instance using the same configuration tool
(*cassandra_config*).
```
cassandra_config -c 'My Cluster' -E -i 10.0.0.1 -s 10.0.0.1 -s 10.0.0.2,10.0.0.3 -S
```
After this steps, the first node of the Cassandra cluster (for a three node
cluster) should be running and configured to start on server boot.
More options can be used on the instance configuration, see the
[Configuration Script](#configuration-script) section for more details
## Services
This AMI will have the SSH service running as well as the Cassandra services.
The following ports will have to be configured on Security Groups.
| Service | Port | Protocol |
|------------------------------------|:------:|:--------:|
| SSH | 22 | TCP |
| Cassandra Inter-Node Cluster | 7000 | TCP |
| Cassandra SSL inter-node cluster | 7001 | TCP |
| JMX Monitoring | 7199 | TCP |
| Cassandra CQL Native Transport | 9042 | TCP |
| Cassandra SSL CQL Native Transport | 9142 | TCP |
| Cassandra Thrift | 9160 | TCP |
More details can be found
[here](http://docs.datastax.com/en/cassandra/3.x/cassandra/configuration/secureFireWall.html?hl=firewall).
## Contributing
1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request
Please read the [CONTRIBUTING.md](CONTRIBUTING.md) file for more details on how
to contribute to this project.
## Versioning
This project uses [SemVer](http://semver.org/) for versioning. For the versions
available, see the [tags on this repository](https://github.com/fscm/packer-aws-cassandra/tags).
## Authors
* **Frederico Martins** - [fscm](https://github.com/fscm)
See also the list of [contributors](https://github.com/fscm/packer-aws-cassandra/contributors)
who participated in this project.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE)
file for details