Functions to access the Amazon EC2 compute service.
Each function takes a map of credentials as its first argument. The credentials map should contain an :access-key key and a :secret-key key. It can also contain an optional :endpoint key if you wish to specify an API endpoint (i.e. region) other than us-east.
Functions to access the Amazon EC2 compute service. Each function takes a map of credentials as its first argument. The credentials map should contain an :access-key key and a :secret-key key. It can also contain an optional :endpoint key if you wish to specify an API endpoint (i.e. region) other than us-east.
(aws-filter name & values)
Returns a Filter that can be used in calls to AWS to limit the results returned.
E.g. (ec2/aws-filter "tag:Name" "my-instance")
Returns a Filter that can be used in calls to AWS to limit the results returned. E.g. (ec2/aws-filter "tag:Name" "my-instance")
(create-image cred params)
Creates an Amazon EBS-backed AMI from a running or stopped instance and returns the new image's id.
params is a map containing the instance id and name, and any other optional parameters.
E.g.:
(ec2/create-image cred { :instance-id "i-deadbabe" :name "web-snapshot" :description "Snapshot of web server" :block-device-mappings [{:device-name "/dev/sdh" :ebs {:delete-on-termination false :volume-size 120}}]})
Creates an Amazon EBS-backed AMI from a running or stopped instance and returns the new image's id. params is a map containing the instance id and name, and any other optional parameters. E.g.: (ec2/create-image cred { :instance-id "i-deadbabe" :name "web-snapshot" :description "Snapshot of web server" :block-device-mappings [{:device-name "/dev/sdh" :ebs {:delete-on-termination false :volume-size 120}}]})
(create-tag k v)
Create an AWS Tag object from a key/value pair.
Create an AWS Tag object from a key/value pair.
(create-tags cred ids tags)
Adds or overwrites tags for the specified resources.
Takes a list of resource ids (e.g. instance ids, AMI ids, etc.) and a map of tags to add or overwrite for the specified resources. E.g.:
(ec2/create-tags cred ["id-deadcafe", "ami-9465dbfd"] {:name "web server" :owner "ops"})
Adds or overwrites tags for the specified resources. Takes a list of resource ids (e.g. instance ids, AMI ids, etc.) and a map of tags to add or overwrite for the specified resources. E.g.: (ec2/create-tags cred ["id-deadcafe", "ami-9465dbfd"] {:name "web server" :owner "ops"})
(decode-exception exception)
Returns a Clojure containing the details of an AmazonServiceException
Returns a Clojure containing the details of an AmazonServiceException
(delete-tags cred ids tags)
Deletes tags from the specified Amazon EC2 resources. E.g.:
Takes a list of resource ids (e.g. instance ids, AMI ids, etc.) and a map of tags to delete from the specified resources. E.g.:
(ec2/delete-tags cred ["id-deadcafe", "ami-9465dbfd"] {:name "web server" :owner "ops"})
To delete a tag without regard to its current value, use nil
:
(ec2/delete-tags cred ["id-deadcafe"] {:owner nil})
Deletes tags from the specified Amazon EC2 resources. E.g.: Takes a list of resource ids (e.g. instance ids, AMI ids, etc.) and a map of tags to delete from the specified resources. E.g.: (ec2/delete-tags cred ["id-deadcafe", "ami-9465dbfd"] {:name "web server" :owner "ops"}) To delete a tag without regard to its current value, use `nil`: (ec2/delete-tags cred ["id-deadcafe"] {:owner nil})
(deregister-image cred image-id)
Deregisters an AMI. Once deregistered, instances of the AMI can no longer be launched.
E.g.:
(ec2/deregister-image cred "ami-9465dbfd")
Deregisters an AMI. Once deregistered, instances of the AMI can no longer be launched. E.g.: (ec2/deregister-image cred "ami-9465dbfd")
(describe-images cred)
(describe-images cred filter)
List all the EC2 images (AMIs), applying the optional filter if supplied.
You can specify filters to limit the number of AMIs returned to those with a specific owner, or to find a specific AMI by id. E.g.:
(ec2/describe-images cred (ec2/image-id-filter "ami-9465dbfd"))
(ec2/describe-images cred (ec2/image-owner-filter "self"))
List all the EC2 images (AMIs), applying the optional filter if supplied. You can specify filters to limit the number of AMIs returned to those with a specific owner, or to find a specific AMI by id. E.g.: (ec2/describe-images cred (ec2/image-id-filter "ami-9465dbfd")) (ec2/describe-images cred (ec2/image-owner-filter "self"))
(describe-instances cred)
(describe-instances cred filter)
List all the EC2 instances for the supplied credentials, applying the optional filter if supplied.
Returns a list of Reservations, a data structure which contains the following keys: :instances - a list of Instances :groups - a list of security groups requested for the instances in this reservation :group-names - a list of security group names requested for the instances in this reservation
You can specify filters to limit the number of instances returned or to find a specific instance. E.g.:
(ec2/describe-instances cred (ec2/instance-id-filter "i-deadcafe"))
List all the EC2 instances for the supplied credentials, applying the optional filter if supplied. Returns a list of Reservations, a data structure which contains the following keys: :instances - a list of Instances :groups - a list of security groups requested for the instances in this reservation :group-names - a list of security group names requested for the instances in this reservation You can specify filters to limit the number of instances returned or to find a specific instance. E.g.: (ec2/describe-instances cred (ec2/instance-id-filter "i-deadcafe"))
(describe-tags cred filter)
Describes one or more of the tags for your EC2 resources.
You can specify filters to limit the response when describing tags. For example, you can use a filter to get only the tags for a specific resource. E.g.:
(ec2/describe-tags cred (ec2/tag-filter-by-resource-id "id-babecafe"))
You can also get all tags for a particular resource type:
(ec2/describe-tags cred (ec2/tag-filter-by-resource-type "image"))
Or specify your own filter:
(ec2/describe-tags cred (ec2/tag-filter (ec2/aws-filter "tag:Name" "*webserver*")))
See http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeTags.html#query-DescribeTags-filters for more information about supported filters.
Describes one or more of the tags for your EC2 resources. You can specify filters to limit the response when describing tags. For example, you can use a filter to get only the tags for a specific resource. E.g.: (ec2/describe-tags cred (ec2/tag-filter-by-resource-id "id-babecafe")) You can also get all tags for a particular resource type: (ec2/describe-tags cred (ec2/tag-filter-by-resource-type "image")) Or specify your own filter: (ec2/describe-tags cred (ec2/tag-filter (ec2/aws-filter "tag:Name" "*webserver*"))) See http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeTags.html#query-DescribeTags-filters for more information about supported filters.
(describe-volumes cred)
(describe-volumes cred filter)
List EBS volumes, applying the optional filter if supplied.
You can specify filters to limit the number of volumes returned to find a specific AMI by id, or with a given status. E.g.:
(ec2/describe-volumes cred (ec2/volume-id-filter "vol-98765432"))
(ec2/describe-volumes cred (ec2/volume-snapshot-filter "snap-abcd1234"))
(ec2/describe-volumes cred (ec2/volume-status-filter :available)))
See http://docs.aws.amazon.com/AWSEC2/latest/CommandLineReference/ApiReference-cmd-DescribeVolumes.html#cmd-DescribeVolumes-filters for a description of available filters.
List EBS volumes, applying the optional filter if supplied. You can specify filters to limit the number of volumes returned to find a specific AMI by id, or with a given status. E.g.: (ec2/describe-volumes cred (ec2/volume-id-filter "vol-98765432")) (ec2/describe-volumes cred (ec2/volume-snapshot-filter "snap-abcd1234")) (ec2/describe-volumes cred (ec2/volume-status-filter :available))) See http://docs.aws.amazon.com/AWSEC2/latest/CommandLineReference/ApiReference-cmd-DescribeVolumes.html#cmd-DescribeVolumes-filters for a description of available filters.
(image-filter & filters)
Returns a filter that can be used with ec2/describe-images. It should be passed a Filter created by ec2/aws-filter.
Returns a filter that can be used with ec2/describe-images. It should be passed a Filter created by ec2/aws-filter.
(image-id-filter id)
Returns an image filter that can be passed to ec2/describe-images to describe a single image.
Returns an image filter that can be passed to ec2/describe-images to describe a single image.
(image-owner-filter owner)
Returns an image filter that can be passed to ec2/describe-images to describe a images owned by a user (e.g. "self" for the current user).
Returns an image filter that can be passed to ec2/describe-images to describe a images owned by a user (e.g. "self" for the current user).
(instance-filter & filters)
Returns a filter that can be used with ec2/describe-instances. It should be passed a Filter created by ec2/aws-filter.
Returns a filter that can be used with ec2/describe-instances. It should be passed a Filter created by ec2/aws-filter.
(instance-id-filter id)
Returns an instance filter that can be passed to ec2/describe-instances to describe a single instance.
Returns an instance filter that can be passed to ec2/describe-instances to describe a single instance.
(mapper-> type)
Creates a function that invokes set-fields on a new object of type with mapped parameters.
Creates a function that invokes set-fields on a new object of type with mapped parameters.
(run-instances cred params)
Launch EC2 instances.
params is a map containing the parameters to send to AWS. E.g.:
(ec2/run-instances cred { :min-count 1 :max-count 1 :image-id "ami-9465dbfd" :instance-type "t1.micro" :key-name "my-key" })
There are many parameters available to control how instances are configured. E.g.:
(ec2/run-instances cred { :min-count 1 :max-count 1 :image-id "ami-9465dbfd" :instance-type "t1.micro" :key-name "my-key" :placement { :availability-zone "ap-southeast-2"} :block-device-mappings [{:device-name "/dev/sdh" :ebs {:delete-on-termination false :volume-size 120}}] :network-interfaces [{:subnet-id "subject-f00fbaaa" :device-index 0 :private-ip-addresses [{:private-ip-address "10.1.1.103" :primary true}]}] })
See http://docs.amazonwebservices.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/ec2/model/RunInstancesRequest.html for a complete list of available parameters.
Launch EC2 instances. params is a map containing the parameters to send to AWS. E.g.: (ec2/run-instances cred { :min-count 1 :max-count 1 :image-id "ami-9465dbfd" :instance-type "t1.micro" :key-name "my-key" }) There are many parameters available to control how instances are configured. E.g.: (ec2/run-instances cred { :min-count 1 :max-count 1 :image-id "ami-9465dbfd" :instance-type "t1.micro" :key-name "my-key" :placement { :availability-zone "ap-southeast-2"} :block-device-mappings [{:device-name "/dev/sdh" :ebs {:delete-on-termination false :volume-size 120}}] :network-interfaces [{:subnet-id "subject-f00fbaaa" :device-index 0 :private-ip-addresses [{:private-ip-address "10.1.1.103" :primary true}]}] }) See http://docs.amazonwebservices.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/ec2/model/RunInstancesRequest.html for a complete list of available parameters.
(set-fields obj params)
Use a map of params to call setters on a Java object
Use a map of params to call setters on a Java object
(start-instances cred & instance-ids)
Start instance(s) that use Amazon EBS volumes as their root device.
Any number of instance ids may be specified. E.g.:
(ec2/start-instances cred "i-beefcafe" "i-deadbabe")
Starting an already-running instance will have no effect.
Start instance(s) that use Amazon EBS volumes as their root device. Any number of instance ids may be specified. E.g.: (ec2/start-instances cred "i-beefcafe" "i-deadbabe") Starting an already-running instance will have no effect.
(stop-instances cred & instance-ids)
Stop instance(s) that use Amazon EBS volumes as their root device.
Any number of instance ids may be specified. E.g.:
(ec2/stop-instances cred "i-beefcafe" "i-deadbabe")
Stopping an already-stopped instance will have no effect.
Stop instance(s) that use Amazon EBS volumes as their root device. Any number of instance ids may be specified. E.g.: (ec2/stop-instances cred "i-beefcafe" "i-deadbabe") Stopping an already-stopped instance will have no effect.
(tag-filter & filters)
Returns a filter that can be passed to ec2/describe-tags to limit the results returned. It should be passed a Filter created by ec2/aws-filter.
Returns a filter that can be passed to ec2/describe-tags to limit the results returned. It should be passed a Filter created by ec2/aws-filter.
(tag-filter-by-resource-id resource-id)
Returns a filter that can be passed to ec2/describe-tags to get all tags for a resource.
Returns a filter that can be passed to ec2/describe-tags to get all tags for a resource.
(tag-filter-by-resource-type resource-type)
Returns a filter that can be passed to ec2/describe-tags to get all tags for a type of resource.
Returns a filter that can be passed to ec2/describe-tags to get all tags for a type of resource.
(terminate-instances cred & instance-ids)
Terminate instance(s).
Any number of instance ids may be specified. E.g.:
(ec2/terminate-instances cred "i-beefcafe" "i-deadbabe")
Terminate instance(s). Any number of instance ids may be specified. E.g.: (ec2/terminate-instances cred "i-beefcafe" "i-deadbabe")
(volume-filter & filters)
Returns a filter that can be used with ec2/describe-volumes. It should be passed a Filter created by ec2/aws-filter.
Returns a filter that can be used with ec2/describe-volumes. It should be passed a Filter created by ec2/aws-filter.
(volume-id-filter id)
Returns a volume filter that can be passed to ec2/describe-volumes to describe a single volume.
Returns a volume filter that can be passed to ec2/describe-volumes to describe a single volume.
(volume-snapshot-filter snapshot-id)
Returns a volume filter that can be passed to ec2/describe-volumes to describe volumes created from the specified snapshot.
Returns a volume filter that can be passed to ec2/describe-volumes to describe volumes created from the specified snapshot.
(volume-status-filter status)
Returns a volume filter that can be passed to ec2/describe-volumes to describe volumes with the specified status (e.g. :in-use).
Returns a volume filter that can be passed to ec2/describe-volumes to describe volumes with the specified status (e.g. :in-use).
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close