# Running a Clojure application on AWS Elastic Beanstalk with Clojure CLI tools

**URL:** https://clojureverse.org/t/running-a-clojure-application-on-aws-elastic-beanstalk-with-clojure-cli-tools/4161
**Category:** How to?
**Created:** [April 17, 2019, 1:16pm UTC](https://clojureverse.org/t/running-a-clojure-application-on-aws-elastic-beanstalk-with-clojure-cli-tools/4161 "2019-04-17T13:16:41Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![orestis](https://clojureverse.org/user_avatar/clojureverse.org/orestis/32/279_2.png) [@orestis](https://clojureverse.org/u/orestis)
#### Post date: [April 17, 2019, 1:16pm UTC](https://clojureverse.org/t/running-a-clojure-application-on-aws-elastic-beanstalk-with-clojure-cli-tools/4161/1 "2019-04-17T13:16:41Z")

</div>

So I wanted to run my Clojure application in Amazon Elastic Beanstalk without going through the trouble of building JARs etc.

I had some issues with file permissions etc so I’m just writing here what needed to be done for others (and Google) to find. I assume you have already created an application and a Java environment based on Amazon Linux and Java 8, and you have successfully deployed the Sample application, and also that you have done the `eb init` dance to setup the Elastic Beanstalk CLI on your machine and project.

1. Setup your application so that it runs via the clojure command like `clojure -m myapp.main`
2. Ensure that you read the HTTP port with `(System/getenv "PORT")` (the default port in EB is 5000), and that you write logs etc to STDOUT and STDERR.
3. Add a `Procfile` at the root of your project containing:

```auto
web: clojure -m myapp.main

```

1. Create an `.ebextensions` directory, and inside it create a file called `setup.config` (only the extension is relevant, you can name it as you please), containing:

```auto
option_settings:
  - option_name: CLJ_CONFIG
    value: /home/webapp/.clojure

commands:
  01_install_clojure:
    command: |
      curl -O https://download.clojure.org/install/linux-install-1.10.0.442.sh
      chmod +x linux-install-1.10.0.442.sh
      sudo ./linux-install-1.10.0.442.sh

```

That’s all! You can now do `eb deploy` (or most probably `eb deploy --staged`) and you should have a working Clojure HTTP application on Elastic Beanstalk.

Your logs appear at `/var/log/web.1.log` (stdout) and `/var/log/web.1.error.log` (stderr).

---

<div class="post-metadata">

### Author: ![system](https://clojureverse.org/uploads/default/original/2X/5/51079bf9e4b7d9466242c06cf1e43b9f8bd6da14.png) [@system](https://clojureverse.org/u/system)
#### Post date: [October 17, 2019, 1:16am UTC](https://clojureverse.org/t/running-a-clojure-application-on-aws-elastic-beanstalk-with-clojure-cli-tools/4161/2 "2019-10-17T01:16:43Z")

</div>

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
