diff --git a/appspec.yml b/appspec.yml index aea80b9..c8f4416 100644 --- a/appspec.yml +++ b/appspec.yml @@ -23,4 +23,10 @@ hooks: runas: ec2-user - location: scripts/switch.sh timeout: 180 - runas: ec2-user \ No newline at end of file + runas: ec2-user + + hooks: + AfterInstall: + - location: scripts/after_install.sh + timeout: 2400 + runas: ec2-user \ No newline at end of file diff --git a/scripts/after_install.sh b/scripts/after_install.sh new file mode 100644 index 0000000..e08fa68 --- /dev/null +++ b/scripts/after_install.sh @@ -0,0 +1,6 @@ +export AWS_ACCESS_KEY_ID=$(aws ssm get-parameters --region ap-northeast-2 --names AWS_ACCESS_KEY_ID --query Parameters[0].Value | sed 's/"//g') +export AWS_SECRET_ACCESS_KEY=$(aws ssm get-parameters --region ap-northeast-2 --names AWS_SECRET_ACCESS_KEY --query Parameters[0].Value | sed 's/"//g') +export DATASOURCE_PASSWORD=$(aws ssm get-parameters --region ap-northeast-2 --names DATASOURCE_PASSWORD --query Parameters[0].Value | sed 's/"//g') +export DATASOURCE_USERNAME=$(aws ssm get-parameters --region ap-northeast-2 --names DATASOURCE_USERNAME --query Parameters[0].Value | sed 's/"//g') +export DATASOURCE_URL=$(aws ssm get-parameters --region ap-northeast-2 --names DATASOURCE_URL --query Parameters[0].Value | sed 's/"//g') +