From d5742fcf703844cc3ad9605829edb21ab894b6ae Mon Sep 17 00:00:00 2001 From: Kyle A Anderson Date: Fri, 26 Jan 2024 20:08:28 -0800 Subject: [PATCH] Docs, Version --- CHANGELOG.md | 3 +++ README.md | 23 +++++++++++++++++++++++ lib/libcluster_ec2.ex | 2 +- 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c30b58..9a2450c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +v0.8.0 +- Enhancement: Support IMDSv2 (Requires ExAws 2.3.2 minimum) https://github.com/kyleaa/libcluster_ec2/pull/33 + v0.7.0 - Enhancement: auto reconnect when disconnected by some reason https://github.com/kyleaa/libcluster_ec2/pull/27 - Dependency Cleanup: Remove Poison dependency https://github.com/kyleaa/libcluster_ec2/pull/23 diff --git a/README.md b/README.md index 1508dfc..9bbc2aa 100644 --- a/README.md +++ b/README.md @@ -27,3 +27,26 @@ def deps do [{:libcluster_ec2, "~> 0.5"}] end ``` + +## 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 application +* `ec2: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": "*" + } + ] +} +``` \ No newline at end of file diff --git a/lib/libcluster_ec2.ex b/lib/libcluster_ec2.ex index 21c6f60..84e7369 100644 --- a/lib/libcluster_ec2.ex +++ b/lib/libcluster_ec2.ex @@ -17,7 +17,7 @@ defmodule ClusterEC2 do |> String.slice(0..-2//1) end - def get_metadata(path) do + defp get_metadata(path) do ExAws.Config.new(:ec2) |> ExAws.InstanceMeta.request("http://169.254.169.254/latest/meta-data#{path}") end