How to Deploy Strapi Docker Container On AWS Elastic Beanstalk

AWS provides many services to host your application there; in this tutorial, I will show you how to deploy Strapi as a Docker container in AWS Elastic Beanstalk.


This is a companion discussion topic for the original entry at https://strapi.io/blog/how-to-deploy-strapi-docker-container-on-aws-elastic-beanstalk

Great tutorial. It was really easy to follow. Can you please tell how to configure S3 for Media Library for the same project ? It will be really helpful. Thanks in advance.

I am getting these errors while creating Beanstalk

.

Can you please help?

Hey I am omar the author of the article sorry or late reply i just seen your comment,
Thanks for the feedback I am glad you liked it, setup s3 of media it a different topic you need to add a plugin for it Upload | Strapi Documentation
How to Set up Amazon S3 Upload Provider Plugin for Your Strapi App

1 Like

the problem here is Beanstalk could not pull the image from the ECR service it due to authentication fails You need to make sure the ec2 instance profile has permission for download and pulling the image check that answer amazon ecr - Beanstalk getting container image from different (ECR) AWS account - Stack Overflow

1 Like

Hi Omar, where exactly I need to put those policy codes? Is it in Dockerrun.aws.json ? or somewhere else?

No, I think it is from IAM roles you need to attach the right policy for the ec2 instance profile,

That an answer from chatgpt to setup(sorry my AWS has a problem so i could not show you the right steps)

To pull an image from Amazon ECR, you need to use an IAM role that has permission to access the ECR repository. You can use an instance profile to pass an IAM role to an EC2 instance¹. Here are the steps to set up an instance profile and attach it to your EC2 instance:

  • Create an IAM role with a policy that allows access to ECR. For example, you can use the AmazonEC2ContainerRegistryReadOnly managed policy².
  • Create an instance profile and add the IAM role to it¹.
  • Attach the instance profile to your EC2 instance². You can do this when you launch the instance or modify it later.
  • Retrieve a set of temporary credentials from the instance metadata and use them to authenticate with ECR³. You can use the aws ecr get-login-password command to get a password for Docker login.

For more details, see the following links:

¹: Using instance profiles - AWS Identity and Access Management
²: IAM roles for Amazon EC2 - Amazon Elastic Compute Cloud
³: Using Amazon ECR with the AWS CLI - Amazon ECR

Source: Conversation with Bing, 4/29/2023
(1) Using instance profiles - AWS Identity and Access Management. Using instance profiles - AWS Identity and Access Management.
(2) IAM roles for Amazon EC2 - Amazon Elastic Compute Cloud. IAM roles for Amazon EC2 - Amazon Elastic Compute Cloud.
(3) Using Amazon ECR with the AWS CLI - Amazon ECR. Using Amazon ECR with the AWS CLI - Amazon ECR.

Hello, how can i use .platform folder to override the default nginx settings?, i tried to create the folder in the root, but it doesn’t seems to work, i don’t see the new config when i navigate the instance using ssh

thank you for your Tutorial! i constantly get this error in my eb-engine log :

ā€œ[ERROR] failed to generate App version manifest file with error Failed to list S3 bucket, err: NoCredentialProviders: no valid providers in chain. Deprecated.
For verbose messaging see aws.Config.CredentialsChainVerboseErrorsā€

can anyone help? Thanks in advance.