Created
May 18, 2015 08:03
-
-
Save anonymous/9881ed581698f2334f03 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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