DEV Community

Syed Mufeth
Syed Mufeth

Posted on • Edited on

Deploy Cryptgeon on AWS AppRunner

Introduction

In this blog i'm going to tell, How to Build Cryptgeon image using Docker, Push it to AWS ECR Repository and pull that image from AWS ECR Repository to Deploy Cryptgeon Service on AWS App Runner.

Prerequisites

  • Docker
  • AWS Single Account or AWS SSO Account
  • AWS CLI

In this guide, I’ll explain:

  • What is Cryptgeon?
  • What is AWS ECR?
  • What is AWS AppRunner?
  • Push Docker Image to AWS ECR Repository.
  • Deploy Cryptgeon Service on AWS APP Runner.

What is Cryptgeon?

Cryptgeon is a secure, open source note/file sharing service.This service used to share secrets, credentials or any files to share with whom you want. This application will encrypt the data given by user in server side and store the notes/files using Redis In-Memory DataBase(IMDB). Redis stores data in RAM, which allows for significantly faster read and write speeds compared to traditional disk-based databases. With help of Redis our notes/files will not save in the server's database, instead it will store in RAM. The notes stored in Redis IMDB will delete after the views, time and while server shut-down.

What is AWS ECR?

AWS ECR (Amazon Elastic Container Registry) is a fully managed container registry service by Amazon Web Services (AWS) that allows developers to store, manage, and deploy Docker and Open Container Initiative (OCI) images.

What is AWS App Runner

AWS App Runner builds and deploys web applications automatically, load balances traffic with encryption, scales to meet your traffic needs, and allows for the configuration of how services are accessed and communicate with other AWS applications in a private Amazon VPC.

Push Docker Image to AWS ECR Repository

In AWS there are two types of accounts:
a).Single Account
b).AWS SSO account

Single Accout

Step 1:
Login in AWS Console navigate to IAM and click the IAM service

Image description

step 2:
In IAM Service left side-bar you will see the access management below that there is Users section click on that

Image description

Then set permission click on attach policies directly in below permission policies search for AmazonEC2ContainerRegistryFullAccess AmazonElasticContainerRegistryPublicFullAccess choose this 2 permission after this click on create a user the user will create

Image description

Step 3:
After completing Step 2 click on the created user there is Nav-bar will come click on Security credentials

Image description

Scroll down and you will see create access key section click on create access key after that choose command line interface

Image description

and the you can see the access_key and Secret_key copy or download the keys.

Image description

AWS SSO Account

Step 1
Sign in to AWS Access Portal in that account below Access Keys click on that.

Image description

Copy the Secret_key, Access_key and Session_token.

Image description

*Push Image to ECR Repository from our local machine *

Step 1:
Go to aws console search for ECR private or public create the repository

Image description

Step 2
Choose a name for your repository create the repository.

Image description

Setup AWS CLI
After copy the Secret_keys setup the AWS Cli in your local machine see the blog and install AWS CLI Install

After install the AWS CLI configure the keys in aws configure
this also a Two Type. which account you using configure with following instruction.

  • AWS single account
  • AWS SSO account

This is for AWS Single account

Step 1:
Go to terminal put aws configure put the copied Access_key and Secret_key and choose the region and leave the format blank

Image description

Step 2:
Retrieve an authentication token and authenticate your Docker client to your registry. Use the AWS CLI:
aws ecr get-login-password --region ap-south-1 | docker login --username AWS --password-stdin YOUR_AWS_ACCOUNT_NUMBER.dkr.ecr.ap-south-1.amazonaws.com

Image description

Login Succeeded.

This is for AWS SSO Account

Step 1:
Go to terminal put aws configure put the copied Access_key and Secret_key and choose the region and leave the format blank

Go to nano ~/.aws/credential add the session token.
aws ecr get-login-password --region ap-south-1 | docker login --username AWS --password-stdin YOUR_AWS_ACCOUNT_NUMBER.dkr.ecr.ap-south-1.amazonaws.com
Then login will success.

After completing this setup.

Build and Push the image to ECR Repository

Step 1:
Clone the directory from my repository Repo Link

Step 2
Build the Cloned docker image
docker build -f Dockerfile.multirun -t YOUR_AWS_ACCOUNT_NUMBER.dkr.ecr.ap-south-1.amazonaws.com/YOUR_IMAGE_NAME:latest .

Step 3
After build step is completed we can push in to our AWS ECR Private or Public repository
docker push YOUR_AWS_ACCOUNT_NUMBER.dkr.ecr.ap-south-1.amazonaws.com/YOUR_IMAGE_NAME:latest

we successfully pushed our docker image in to our AWS ECR Repository.

Deploy Cryptgeon Service on AWS APP Runner

Step 1:
In AWS console Search for App Runner

Image description

Click it

Step 2:
create a service in App Runner

Image description

After that in source and deployment section choose container registry and below section which repository you stored the Cryptgeon image ECR private or ECR Public copy the image URI and paste here

Image description

Here I stored my image in ECR Private Repository.

Deployment setting you can choose manual or automatic. here I choosed manual and we need to create role. click on create a new service role and click on next.

Image description

Step 3:
In Configure Service section we need to set the name for service
I used Cryptgeon. choose the vcpu size and ram here I selected minimum requirement. in the port section select 8000 because cryptgeon default port is binded in 8000

Image description

After all the section leave it default. create the service and deploy on Apprunner.

Everything is completed you can see the URL in service overview section default domain click the URL our service will mapped on the domain.

Image description

After Following this guide you can deploy the Cryptgeon on AWS AppRunner

Top comments (0)