4. Configure EC2 (editing)

Launch an EC2

Launch an EC2 that will run jar.

name: our-company-lunch-ec2-v6

os: Amazon Linux 2023 AMI

type: t2.micro

subnet: public

security group: allow HTTP

The name tag input here will be used at CodeDeploy configuration. The -v6 suffix is just my trial counts.

Install java and nginx

Connect to the EC2 terminal.

Switch to root user.

sudo -i

Update a package index.

dnf update -y

Install java.

Install nginx.

Configure nginx

circle-info

A filename inside conf.d doesn't matter. All config files will be loaded.

This will relay a request from the designated address and port to localhost:8080.

A Spring server would be up and running on 8080 port.

client_max_body_size 20M for image upload.

nginx server name length related.

The default is 64.

https://serverfault.com/questions/656496/why-is-14-characters-the-maximum-length-for-the-nginx-server-name-directivearrow-up-right

Last updated