Skip to content

Amazonicaλ︎

Very Rough Draft

Amazonica logo

A comprehensive Clojure client for the entire [Amazon AWS API][1], essentially a wrapper acound the Java client library for AWS.

amazonica

Examples in Amazonica project readme not working

Project Dependencyλ︎

Add amazonica as a project dependency, to either a Clojure CLI or Leiningen project.

deps.edn
amazonica/amazonica {:mvn/version "0.3.165"}
project.clj
[amazonica "0.3.165"]

Basic exampleλ︎

(ns com.example
  (:require [amazonica.aws.ec2 :as aws-ec2]))

(aws-ec2/describe-instances)

(aws-ec2/create-snapshot
  :volume-id   "vol-8a4857fa"
  :description "snapshot for testing")

Amazonica uses the Java client library to support the complete set of remote service calls implemented by each of the service-specific AWS client classes (e.g. AmazonEC2Client, AmazonS3Client, etc.)

  • [AWS Javadocs][2].
  • [cljdoc function references][25]

Reflection is used to create idiomatically named Clojure Vars in the library namespaces corresponding to the AWS service.

camelCase Java methods become lower-case, hyphenated Clojure functions.

Create snapshot of running EC2 instance

(aws-ec2/create-snapshot
  :volume-id "vol-8a4857fa"
  :description "my_new_snapshot")

aws-ec2/create-snapshot delegates to [createSnapshot()][3] method of AmazonEC2Client.

Java methods that take a parameter, e.g. [CreateSnapshotRequest][4] have their bean properties exposed via mutators and can be supplied as key-value pairs passed as arguments to the Clojure function.

All of the AWS Java APIs (except S3) follow this pattern, either having a single implementation method that takes an AWS Java bean as its only argument, or being overloaded and having a no-arg implementation.

The corresponding Clojure function will either require key-value pairs as arguments, or be variadic and allow a no-arg invocation.

AmazonEC2Client's [describeImages()][7] method is overloaded and can be invoked either with no args or with a [DescribeImagesRequest][8].

Clojure invocation

(aws-ec2/describe-images)

or

(aws-ec2/describe-images
  :owners ["self"]
  :image-ids ["ami-f00f9699" "ami-e0d30c89"])
Supported Services

AWS services supported by Amazonica * Amplify * API Gateway * AppConfig * Application Insights * App Mesh * Augmented AI * Autoscaling * Austocaling Plans * Backup * Batch * Budgets * Certificate Manager * CloudDirectory * CloudFormation * CloudFront * CloudSearch * CloudSearchV2 * CloudSearchDomain * CloudWatch * CloudWatchEvents * CodeBuild * CodeCommit * CodeDeploy * CodePipeline * CodeStar * Cognito * CognitoIdentityProviders * Comprehend * Compute Optimizer * Config * Connect * CostAndUsageReport * CostExplorer * DatabaseMigrationService * DataPipeline * Data Exchange * Data Sync * Dax * Detective * DeviceFarm * DirectConnect * Directory * DLM * DocDB * DynamoDBV2 * EC2 * EC2InstanceConnect * ECR * ECS * ElastiCache * ElasticBeanstalk * ElasticFileSystem * ElasticLoadBalancing * ElasticMapReduce * Elasticsearch * ElasticTranscoder * Event Bridge * Forecast * Fraud Detector * GameLift * Glacier * Global Accelerator * Glue * GreenGrass * Groundstation * GuardDuty * IdentityManagement * Image Builder * ImportExport * IoT * Kafka * Kendra * Kinesis * Kinesis Analytics * KinesisFirehose * Kinesis Video Streams with WebRTC (Signaling Channels) * KMS * Lake Formation * Lambda * Lex * Lightsail * Logs * MachineLearning * Macie * Managed Blockcahin * MechanicalTurk * MediaConvert * MediaLive * MediaPackage * MediaStore * MigrationHub * Mobile * MQ * MSK (Managed Kafka) * OpsWorks * Personalize * Pinpoint * Pricing * Polly * QLDB * Quicksight * RDS * Redshift * Rekognition * Route53 * Route53Domains * S3 * Sagemaker * Secrets Manager * Security Hub * Security Token * ServerMigration * ServiceCatalog * Service Discovery * Shield * SimpleDB * SimpleEmail * SimpleSystemsManager * SimpleWorkflow * Snowball * SNS * SQS * StepFunctions * StorageGateway * Support * Textract * Timestream * Transcribe * Transfer * Translate * WAF * Workspaces * XRay