Build a GeoServer with AWS App Runner and Amazon ECR
Tags: apprunner, ecr, geoserver, aws
Published: 2022-08-30 13:38:08

![img](https://day-journal.com/memo/images/try-094_01.png)

### I built a GeoServer with AWS App Runner and Amazon ECR. :tada:  

<br>

The following is a detailed explanation.

- Repository creation
- Image registration
- Deployment

<br>

## Repository creation

First, here is how to create a repository in Amazon ECR.

Click AWS Management Console → Elastic Container Registry.
![img](https://day-journal.com/memo/images/amazon-ecr-001_01.png)

Click on "Create Repository."
![img](https://day-journal.com/memo/images/amazon-ecr-001_02.png)

Configure general settings and details → Click on "Create Repository."
In this case, we set it as Public. 
![img](https://day-journal.com/memo/images/amazon-ecr-001_03.png)

You can see the repository has been created.
![img](https://day-journal.com/memo/images/amazon-ecr-001_04.png)

This completes the repository creations!

<br>

## Image Registration

The next step is to register the image with Amazon ECR.

Select repository → Click "Show push command."
![img](https://day-journal.com/memo/images/amazon-ecr-002_01.png)

Copy the command as it appears.
![img](https://day-journal.com/memo/images/amazon-ecr-002_02.png)

Execute the command with AWS CLI to push the image to the repository.
In this case, we used the GeoServer Docker image "[kartoza/geoserver](https://hub.docker.com/r/kartoza/geoserver)."

```sh
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/xxxxx
```

```sh
docker tag kartoza/geoserver:latest public.ecr.aws/xxxxx/sample:latest
```

```sh
docker push public.ecr.aws/xxxxx/sample:latest
```

![img](https://day-journal.com/memo/images/amazon-ecr-002_03.png)

After the push is complete, click on the target repository.
![img](https://day-journal.com/memo/images/amazon-ecr-002_04.png)

You will see that the image has been registered.
![img](https://day-journal.com/memo/images/amazon-ecr-002_05.png)

That completes the registration of the image!

<br>

## Deployment

Finally, how to deploy with AWS App Runner.

Click AWS Management Console → AWS App Runner.
![img](https://day-journal.com/memo/images/aws-app-runner-001_01.png)

Click on "Create App Runner Service."
![img](https://day-journal.com/memo/images/aws-app-runner-001_02.png)

Configure source and deploy settings → Click "Next."
This time, specify the image configured in ECR Public.
![img](https://day-journal.com/memo/images/aws-app-runner-001_03.png)

Configure service settings → Click "Next. 
The default values for optional memory and CPU are low, so increase them to the range where GeoServer can run. Other default values are used.
![img](https://day-journal.com/memo/images/aws-app-runner-001_04.png)

Click "Create and Deploy.
![img](https://day-journal.com/memo/images/aws-app-runner-001_05.png)

Wait for a while, and then the environment construction will be completed.
The URL is displayed in detail, so add "/geoserver" and access it with a browser.
![img](https://day-journal.com/memo/images/aws-app-runner-001_06.png)

You can see GeoServer is up and running!
![img](https://day-journal.com/memo/images/aws-app-runner-001_07.png)

<br>
<br>

References
[Amazon ECR](https://aws.amazon.com/ecr)
[AWS App Runner](https://aws.amazon.com/apprunner)
[GeoServer](https://geoserver.org)