홈>
우분투 16.04를 사용하여 cloudformation 스크립트를 작성하고 userdata/cloud init 스크립트를 구현했습니다. 그러나 cfn-hup을 시작하려고하면 init.d 스크립트를 기반으로 실패합니다. 스크립트는 다음과 같습니다. 기본 시작 레벨을 이해하기 위해 모든 곳을 검색했으며 수동으로 편집 할 수는 있지만 다른 템플릿에서 찾을 수 없으므로 다른 작업을 수행해야합니까?! 아래 스크립트.
아이디어가 있다면 공유해주세요. 감사합니다.
2018-01-17 11:58:36,562 P7799 [INFO] Command 01_enable_cfn_hup
2018-01-17 11:58:36,665 P7799 [INFO] -----------------------Command Output-----------------------
2018-01-17 11:58:36,665 P7799 [INFO] Synchronizing state of cfn-hup.service with SysV init with /lib/systemd/systemd-sysv-install...
2018-01-17 11:58:36,665 P7799 [INFO] Executing /lib/systemd/systemd-sysv-install enable cfn-hup
2018-01-17 11:58:36,665 P7799 [INFO] insserv: warning: script 'cfn-hup' missing LSB tags and overrides
2018-01-17 11:58:36,665 P7799 [INFO] update-rc.d: error: cfn-hup Default-Start contains no runlevels, aborting.
2018-01-17 11:58:36,665 P7799 [INFO] ------------------------------------------------------------
2018-01-17 11:58:36,665 P7799 [ERROR] Exited with error code 1
스크립트 :
AppServerInstanceLaunchConfig:
Type: 'AWS::AutoScaling::LaunchConfiguration'
DependsOn: VPCGatewayAttachment
Properties:
AssociatePublicIpAddress: true
KeyName: !Ref KeyPairName
ImageId: !FindInMap
- AWSRegionArch2AMI
- !Ref 'AWS::Region'
- !FindInMap
- AWSInstanceType2Arch
- !Ref InstanceTypeParam
- Arch
InstanceType: !Ref InstanceTypeParam
SecurityGroups:
- !Ref PubSubnetSecurityGroup
UserData: !Base64
'Fn::Join':
- ''
- - |
#!/bin/bash -xe
- |
# Install AWS cfn-bootstrap utilities
apt-get update
apt-get -y install python-pip
- >
pip install
https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-latest.tar.gz
- |
ln -s /usr/local/bin/cfn-hup /etc/init.d/
- |
chmod 775 /etc/init.d/cfn-hup
- |
chown root:root /etc/init.d/cfn-hup
- /usr/local/bin/cfn-init
- ' --stack '
- !Ref 'AWS::StackName'
- ' --resource AppServerInstanceLaunchConfig'
- ' --configsets SetupAppServer'
- ' --region '
- !Ref 'AWS::Region'
- |+
- /usr/local/bin/cfn-signal -e $? --stack
- !Ref 'AWS::StackName'
- ' --resource AppServerInstanceGroup'
- ' --region '
- !Ref 'AWS::Region'
Metadata:
'AWS::CloudFormation::Designer':
id: 7f848ae7-0378-4ac3-800c-1f4c1ad4de4c
'AWS::CloudFormation::Init':
configSets:
SetupAppServer:
- config1
config1:
packages:
apt:
git: []
php: []
apache2: []
apt-transport-https: []
ca-certificates: []
curl: []
software-properties-common: []
commands:
01_enable_cfn_hup:
command: systemctl enable cfn-hup.service
02_start_cfn_hup:
command: systemctl start cfn-hup.service
files:
/etc/cfn/cfn-hup.conf:
content: !Join
- ''
- - |-
[main]
stack=
- !Ref 'AWS::StackName'
- |-
region=
- !Ref 'AWS::Region'
mode: '000400'
owner: root
group: root
/etc/cfn/hooks.d/cfn-auto-reloader.conf:
content: !Join
- ''
- - |
[cfn-auto-reloader-hook]
- |
triggers=post.update
- >
path=Resources.LaunchConfig.Metadata.AWS::CloudFormation::Init
- 'action=/usr/local/bin/cfn-init -v --stack '
- !Ref 'AWS::StackName'
- ' --resource AppServerInstanceLaunchConfig --region '
- !Ref 'AWS::Region'
- ''
- |
runas=root
/lib/systemd/system/cfn-hup.service:
content: !Join
- ''
- - |
[Unit]
- |+
Description=cfn-hup daemon
- |
[Service]
- |
Type=simple
- |
ExecStart=/usr/local/bin/cfn-hup
- |+
Restart=always
- |
[Install]
- WantedBy=multi-user.target
services:
sysvinit:
apache2:
enabled: true
ensureRunning: true
cfn-hup:
enabled: true
ensureRunning: true
files:
- /etc/cfn/cfn-hup.conf
- /etc/cfn/hooks.d/cfn-auto-reloader.conf
- 답변 # 1
- 답변 # 2
여기에 나온 조언에 따라 우분투 16.04 EC2에서 cfn-hup을 성공적으로 초기화했습니다. 아마도 잊어 버린 것 같습니다 :
cfn-init
chmod +x /usr/local/lib/python2.7/dist-packages/aws_cfn_bootstrap-1.4-py2.7.egg/init/ubuntu/cfn-hup
관련 자료
- amazon web services - Cloudformation 스택 기본 매개 변수 SSM 매개 변수 저장소
- 데비안/우분투 - grub-customizer가 시작되지 않습니다
- artifactory - jfrog-xray가 시작되지 않음 (새 설치)
- javascript - create-react-app가 설치되지만 "시작"으로 실행되지 않습니다
- javaScript function - 자바 스크립트 기능 - 왜 내 기본 논증이 실패합니까?
- Fortify API Start Scan with Default - 기본값으로 fortify api 시작 스캔 - 패키지를 보내는 방법
- java - Elastic Beanstalk에서 스프링 부트 앱이 시작되지 않음
- windows - 브리지 어댑터 문제로 인해 VirtualBox VM이 시작되지 않습니다
- "시작 메뉴 폴더를 만들지 마십시오"-Inno Setup- 줄에 체크 표시를하는 방법은 무엇입니까?
- Ionic Capacitor iOS Firebase 앱이 시작되지 않음
- daemon - Centos 7에서 Docker 17이 시작되지 않습니다
- azure web sites - aspnet 코어 Out-of-process가 올바르게 시작되지 않습니다
- database - Linux 용 Windows 서브 시스템에서 실행중인 Ubuntu 1804에서 PostreSQL 10이 시작되지 않음
- amazon web services - ecs - 작업이 시작되지 않지만 컨테이너가 제대로 보입니다 로그에 오류를 표시하지 않습니다
- python - 기본 생성 후 Jupyter Book 빌드 실패
- node.js - Heroku가 시작 스크립트에서 실패하지만 내 packagejson에 표준 시작 스크립트가 있습니다
- hibernate - unsatisfieddependencyexception : unsatisfied dependency로 인해 spring mvc 프로젝트 시작 실패
- docker - Liferay 컨테이너가 사용자 정의 serverxml로 시작하지 못합니다
관련 질문
- ECS 서비스 : 서비스 작업에 공용 IP를 할당하지 않고 ECR 레지스트리에서 Docker 이미지를 가져올 수 없음
- cloudformation yaml이 잘못된 기본 형식을 계속 가져옵니다.
- AWS DescribeStacks 작업-특정 리소스로 제한 할 수 있습니까?
- CloudFormation으로 만든 퍼블릭 EC2에 연결할 수 없습니다.
- Jumpbox 용 AWS CloudFormation 사용자 데이터
- 람다 함수를 트리거하는 방법 이벤트 유형 : ObjectCreatedByPut
- 사용자가 수행 할 권한이 없습니다. cloudformation : CreateStack
- AWS CloudFormation 및 서버리스에서 스택 및 공유 리소스 구성
- 배포시 ID 오류가있는 호스팅 영역을 찾을 수 없음
- Cloud Formation을 사용하여 Lambda에 대한 동적 변수를 설정하는 방법
우분투가 대상 배포 인 경우 잘못된
cfn-hup
를 연결하는 것처럼 보입니다. 초기화 스크립트.cfn-hup
에서 LSB 헤더를 찾으면 파일을 연결하면 파일이없는 것을 알 수 있습니다.여기에서 cfn-hup 문서에 묻혀 있습니다 : https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-helper-scripts-reference.html, 우분투의 경우 다른 심볼릭 링크가 필요합니다
그러나 pyzwyz 설치 방법에 따라 해당 파일이 다른 위치에있을 수 있습니다. 나를 위해 여기에있었습니다 :/usr/local/bin/cfn-hup
대신 AWS가 제공하는 init 스크립트 코드에서) :다음을 실행해야합니다 :
update-rc.d cfn-hup defaults
를 시작하기 직전