View Source ClusterEC2 (libcluster_ec2 v0.8.2)
ClusterEC2
This is an EC2 clustering strategy for libcluster. It currently supports identifying nodes based on EC2 tags.
The default Tags
strategy uses ex_aws to query the EC2 DescribeInstances API endpoint. Access to this API should be granted to the EC2 instance profile. See the ExAws docs for additional configuration options.
config :libcluster,
topologies: [
example: [
strategy: ClusterEC2.Strategy.Tags,
config: [
ec2_tagname: "elasticbeanstalk:environment-name"
],
]
]
installation
Installation
The package can be installed
by adding libcluster_ec2
to your list of dependencies in mix.exs
:
def deps do
[{:libcluster_ec2, "~> 0.5"}]
end
aws-iam-requirements
AWS IAM Requirements
Instances must have an instance role attached. There are two permissions required:
ec2:DescribeInstances
- Required to determine tag values of the current running instance. Can be restricted by Resource to the current instance running the applicationec2:DescribeTags
- Required to identify other instances with the same tags
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"ec2:DescribeInstances",
"ec2:DescribeTags"
],
"Resource": "*"
}
]
}
Link to this section Summary
Functions
Queries the local EC2 instance metadata API to determine the aws resource region of the current instance.
Queries the local EC2 instance metadata API to determine the instance ID of the current instance.