Skip to content

Instantly share code, notes, and snippets.

Created May 18, 2015 08:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/9881ed581698f2334f03 to your computer and use it in GitHub Desktop.
Save anonymous/9881ed581698f2334f03 to your computer and use it in GitHub Desktop.
defmodule Aws do
def main(args) do
access_key_id = System.get_env("AWS_ACCESS_KEY_ID") |> String.to_char_list
secret_access_key = System.get_env("AWS_SECRET_ACCESS_KEY") |> String.to_char_list
ec2_endpoint = String.to_char_list("ec2.ap-northeast-1.amazonaws.com")
:erlcloud_ec2.configure(access_key_id, secret_access_key, ec2_endpoint)
ami = String.to_char_list("ami-18869819")
instancetype = String.to_char_list("t2.micro")
az = String.to_char_list("ap-northeast-1a")
key = String.to_char_list("mykey")
spec = %ec2_instance_spec{
image_id: ami,
instance_type: instancetype,
availability_zone: az,
key_name: key}
:erlcloud_ec2.run_instances(spec)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment