공부/에러노트

[AWS] 플랫폼 후크를 사용한 Elastic Beanstalk 권한 설정

aerhergag0 2024. 1. 17. 23:54

https://repost.aws/ko/knowledge-center/elastic-beanstalk-platform-hooks

 

플랫폼 후크를 사용해 Elastic Beanstalk 사용자 지정

플랫폼 후크를 사용하여 사용자 지정 스크립트 또는 기타 실행 파일을 생성하여 AWS Elastic Beanstalk 환경을 사용자 지정하고자 합니다. 해당 환경에서 실행되는 Amazon Elastic Compute Cloud(Amazon EC2) 인스

repost.aws

 

리액트 권한문제 발생

web: > react-scripts start
web: sh: /var/app/current/node_modules/.bin/react-scripts: Permission denied

 

 

project-root/
|-- .platform/
|   |-- hooks/
|      └-- prebuild/
|         └-- 01-nodejs-scripts-permission.sh
|
|-- ...

 

 

01-nodejs-scripts-permission.sh

#!/bin/bash

sudo usermod -G webapp -a ec2-user
sudo /bin/chmod 776 /var/app/staging/node_modules/.bin/react-scripts
sudo /bin/chmod 776 /var/app/current/node_modules/.bin/react-scripts

 

xdg 오류문제시

sudo yum install xdg-utils -y

 

 

eb deploy로 재배포 후 확인