AWSError::An error occurred (InvalidSignatureException) when calling the GetAuthorizationToken operation

2018-04-05

μ•ˆλ…•ν•˜μ„Έμš” μƒμΌμž…λ‹ˆλ‹€. 이번 ν¬μŠ€νŠΈμ—μ„œλŠ” μ œκ°€ Docker 이미지λ₯Ό 배포할 λ•Œ AWS ECSμ—μ„œ κ²ͺ은(?) μ—λŸ¬μ— λŒ€ν•΄μ„œ ν¬μŠ€νŒ… ν•΄λ³΄κ² μŠ΅λ‹ˆλ‹€.

μ–Όλ§ˆ 전에 도컀 이미지λ₯Ό λ°°ν¬ν•˜λ‹€κ°€ λ‹€μŒκ³Ό 같은 μ—λŸ¬κ°€ λ°œμƒ ν–ˆλŠ”λ°μš”..

Error log

An error occurred (InvalidSignatureException) when calling the GetAuthorizationToken operation: 
Signature not yet current: 20180404T155030Z is still later than 20180404T070416Z (20180404T064916Z + 15 min.)

μœ„μ˜ μ—λŸ¬λ‘œκ·Έλ₯Ό 잘 λ³΄μ‹œλ©΄ μ–΄λ–€ μ—λŸ¬μΈμ§€ 감이 올 κ²ƒμž…λ‹ˆλ‹€. 이 μ—λŸ¬κ°€ λ°œμƒν•˜λŠ” μ΄μœ λŠ” κ°„λ‹¨νžˆ λ§ν•΄μ„œ μš”μ²­μ— μ„œλͺ…λœ μ‹œκ°„κ³Ό μš”μ²­μ‹œκ°„μ΄ μΌμΉ˜ν•˜μ§€ μ•Šμ•„μ„œ μž…λ‹ˆλ‹€. λ”°λΌμ„œ, μ„œλ²„μ‹œκ°„λ§Œ 동기화 ν•΄μ£Όλ©΄ ν•΄κ²°λ˜λŠ” μ—λŸ¬μž…λ‹ˆλ‹€.

μ•„λž˜ μΈμš©ν•œ λ¬Έκ΅¬λŠ” AWSκ°€ μ™œ μ΄λŸ¬ν•œ μ—λŸ¬λ₯Ό λ°œμƒμ‹œν‚€λŠ”μ§€μ— λŒ€ν•΄μ„œ μ„€λͺ…ν•œ κ²ƒμž…λ‹ˆλ‹€.

λ§Žμ€ μ„œλ²„ μž‘μ—…κ³Ό ν”„λ‘œμ„ΈμŠ€μ—μ„œ μΌκ΄€λ˜κ³  μ •ν™•ν•œ μ‹œκ°„ μ°Έμ‘°κ°€ μ€‘μš”ν•©λ‹ˆλ‹€. λŒ€λΆ€λΆ„μ˜ μ‹œμŠ€ν…œ λ‘œκ·Έμ—λŠ” λ¬Έμ œκ°€ λ°œμƒν•œ μ‹œκ°„κ³Ό μ΄λ²€νŠΈκ°€ λ°œμƒν•œ μˆœμ„œλ₯Ό νŒŒμ•…ν•˜λŠ” 데 μ‚¬μš©ν•  수 μžˆλŠ” νƒ€μž„μŠ€νƒ¬ν”„κ°€ ν¬ν•¨λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€. AWS CLI λ˜λŠ” AWS SDKλ₯Ό μ‚¬μš©ν•˜μ—¬ μΈμŠ€ν„΄μŠ€μ—μ„œ μš”μ²­ν•˜λŠ” 경우 μ΄λŸ¬ν•œ 도ꡬ가 μ‚¬μš©μžλ₯Ό λŒ€μ‹ ν•˜μ—¬ μš”μ²­μ— μ„œλͺ…ν•©λ‹ˆλ‹€. μΈμŠ€ν„΄μŠ€μ˜ λ‚ μ§œμ™€ μ‹œκ°„μ΄ 잘λͺ» μ„€μ •λ˜μ–΄ 있으면 μ„œλͺ… λ‚ μ§œκ°€ μš”μ²­ λ‚ μ§œμ™€ μΌμΉ˜ν•˜μ§€ μ•Šμ•„ AWSκ°€ ν•΄λ‹Ή μš”μ²­μ„ κ±°λΆ€ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

Linux μΈμŠ€ν„΄μŠ€μ˜ μ‹œκ°„ μ„€μ • - Amazon Elastic Compute Cloud

Solution

  1. REHEL 계열
yum erase ntp*
yum -y install chrony

# /etc/chrony.conf λͺ…λ Ήμ–΄κ°€ 포함 λ˜μ–΄μžˆλŠ”μ§€ 확인 ν›„ μΆ”κ°€
# server 169.254.169.123 prefer iburst
service chronyd start
  1. Debian 계열
apt install -y chrony

# /etc/chrony/chrony.conf λͺ…λ Ήμ–΄κ°€ 포함 λ˜μ–΄μžˆλŠ”μ§€ 확인 ν›„ μΆ”κ°€
# server 169.254.169.123 prefer iburst
/etc/init.d/chrony restart
chronyc sources -v

Reference

  • https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/set-time.html (μ˜μ–΄)
  • https://docs.aws.amazon.com/ko_kr/AWSEC2/latest/UserGuide/set-time.html (ν•œκ΅­μ–΄)