Deploy laravel using docker on EC2 on AWS ① (Create EC2 instance)

Overview##

-I will write the process of deploying laravel / docker on AWS for those who are stuck at the same point as the point where they are stuck.


Prerequisites

-It will be Mac standard. -The laravel app has been pushed to git. -Docker must be installed. ・ You can log in to AWS.


Construction environment

・ Php7.4 ・ Mysql8.0 ・ Laravel6

Building docker @ ucan-lab's article [For beginners] Docker hands-on to build Laravel development environment at explosive speed in 20 minutes I created it with reference to.


change point##

version: "3.3"← Change
services:
  app:
    build: ./infra/php
    volumes:
      - ./backend:/work

  web:
    image: nginx:1.18-alpine
    ports:
      - 10080:80
    volumes:
      - ./backend:/work
      - ./infra/nginx/default.conf:/etc/nginx/conf.d/default.conf
    working_dir: /work

EC2 instance creation

スクリーンショット 2020-10-10 21.43.16.png

Please specify Tokyo as the region at the top right of the screen. Open the service at the top left of the screen and select EC2. If you can't find it, type "EC2" from all services to search. Click EC2 to access.

** 1: Creating a web server ** Click Launch Instance, and when the selection screen appears, click Launch Instance. スクリーンショット 2020-10-11 0.47.24.png

** 2: Select AMI ** Select "ubuntu 18.04" for AMI. ![Screenshot 2020-10-10 21.45.31.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/778706/b635274f-3280-5f2a-eb05- f04b02096d43.png)

** 3: Instance type selection ** Select "t2.micro", which is free for one year from new registration. スクリーンショット 2020-10-10 21.45.44.png

** 4: Instance details ** Proceed as standard. スクリーンショット 2020-10-10 21.45.52.png

** 5: Add storage ** Proceed as standard. スクリーンショット 2020-10-11 0.47.57.png

** 6: Add tag ** Add a tag and give the value any name you like. This time I named it "awstest". If you make one, go to the next. スクリーンショット 2020-10-10 21.46.12.png

** 7: Security group settings ** Set any security group name and description. This time I named it "test-docker". Added rules and added "HTTP", "HTTPS", and "Custom TCP rules". Specify the port range only for custom TCP. This time, set "10080". Set "Custom" and "0.0.0.0/0, :: / 0" for the source. After setting everything, go to the next. スクリーンショット 2020-10-10 21.47.41.png

** 8: Instance creation ** Click the start button. スクリーンショット 2020-10-10 21.47.49.png

Creating a key pair

Click the "Launch" button of the instance to display the key pair creation screen. スクリーンショット 2020-10-10 21.48.03.png For those who create an EC2 instance for the first time Choose to create a new key pair and give the key pair a name of your choice. ** Please be sure to download the key pair. ** </ font> Then click Create Instance.

Confirmation of created instance

If you return to the EC2 screen, you can see that there is an instance you created. In the place of Name, there is the name given in the tag item. When it becomes "Running" and "Passed the 2/2 check", it is complete. スクリーンショット 2020-10-10 22.04.12.png

Continued

Click here for more [Deploy laravel using docker on EC2 on AWS②] (https://qiita.com/JXnj8uVrUkiBh90/items/0cdac8045965e2bfffa6)

** Please point out any mistakes **

Recommended Posts

Deploy laravel using docker on EC2 on AWS ① (Create EC2 instance)
Deploy laravel using docker on EC2 on AWS ② (Elastic IP acquisition-linking)
Deploy laravel using docker on EC2 on AWS ④ (git clone ~ deploy, migration)
Deploy laravel using docker on EC2 on AWS ③ (SSH connection ~ Docke-compose installation)
Deploy with EC2 / Docker / Laravel
Install docker on AWS EC2
Deployed using Docker + Rails + AWS (EC2 + RDS)
How to create a web server on an EC2 instance on AWS
Build a Laravel environment on an AWS instance
I tried installing docker on an EC2 instance
Deploy RAILS on EC2
How to install Ruby on an EC2 instance on AWS
[Docker] Build an Apache container on EC2 using dockerfile
Creating a docker host on AWS using Docker Machine (personal memorandum)
[Amateur remarks] Build multiple WordPress on AWS using Docker Compose
Install Docker on AWS Ubunt 20.04 LTS
To beginners launching Docker on AWS
Run the AWS CLI on Docker
Deploy Flask's Docker image on Heroku
How to publish an application using AWS (3) EC2 instance environment construction
Create Laravel environment with Docker (docker-compose)
Deploy Rails on Docker to heroku
Deploy SpringBoot application to AWS EC2
Using Docker on Windows10 Home WSL2
[Rails] AWS EC2 instance environment construction
[For beginners] Laravel Docker AWS (EC2) How to easily deploy a web application (PHP) from 0 (free) ①-Overview-
[AWS ELB] Using ELB and Docker, EC2 has two domains for WEB servers.
Summary of Docker understanding by beginners ⑤ ~ Until deploying docker container on EC2 instance ~
Create a web environment quickly using Docker
Launch docker container on EC2 (personal memorandum)
Send an email using JavaMail on AWS
Deploy your application with VPC + EC2 + Docker.
Build an environment with Docker on AWS
Try the Docker environment on AWS ECS
[For beginners] Laravel Docker AWS (EC2) How to easily deploy Web application (PHP) from 0 (free) ②-Docker development environment construction-
I tried to create a portfolio with AWS, Docker, CircleCI, Laravel [with reference link]
Create a Privoxy + Tor environment instantly using Docker
How to deploy a container on AWS Lambda
Just install Laravel8 on docker in PHP8 environment
Create an EC site using stripe! (Account creation)
Error installing ruby execution environment on EC2 instance
I installed Docker on EC2 and started it
Send emails using Docker container on Raspberry Pi 3
Recipe for deploying Rails apps on AWS EC2
[Rails AWS Docker] Build an existing Ruby on Rails + MySQL application with Docker and deploy it on AWS (5)
[Rails AWS Docker] Build an existing Ruby on Rails + MySQL application with Docker and deploy it on AWS (6)
[Rails AWS Docker] Build an existing Ruby on Rails + MySQL application with Docker and deploy it on AWS (3)
[Rails AWS Docker] Build an existing Ruby on Rails + MySQL application with Docker and deploy it on AWS (2)
[Rails AWS Docker] Build an existing Ruby on Rails + MySQL application with Docker and deploy it on AWS (1)
[Rails AWS Docker] Build an existing Ruby on Rails + MySQL application with Docker and deploy it on AWS (4)
Place "Create a to-do list using Rails API mode and React Hooks" on docker