[AWS] SNS Topics์ ๋ฑ๋กํ Pending confirmation ์ํ์ Subscription ์ญ์
๊ฐ์
Amazon SNS์์ Topic์ ์์ฑํ๊ณ Subscriptions์ email์ createํ๋ ๊ณผ์ ์์ ์คํ๊ฐ ๋ฐ์ํ์ฌ ์๋ชป๋ email์ ๋ฑ๋กํด๋ฒ๋ ธ๋ค.
์ด๋ฏธ Request confirmation์ด ๋ ์ํ์ธ๋ฐ, ์๋ชป๋ email์ด๋ ์ธ์ฆ์ด ์งํ๋์ง ์์์ Pending confirmation ๋ผ๋ status ๋ก ์๋ฅํ๊ณ ์๋ค.
Pending confirmation ์ธ ์ํ๊ฐ ์์ผ๋๊น
ํด๋น Topic์ ์ฌ์ฉํ๋ Alarm์๋ warning ์ด ํ์๋๋ค.
์งํ
1. AWS์์ ๋ฐ๋ก ์ญ์ ์๋
์ญ์ ํ๊ณ ์ถ์ email์ ์ ํํด๋ Edit, Delete ๋ฒํผ์ด ๋นํ์ฑํ๋์ด์ ์ญ์ ๋ฅผ ์งํํ ์ ์๋ค.
2. python ์คํฌ๋ฆฝํธ๋ก ์ ๊ทผํ์ฌ ์ญ์ ์๋
์ง์ ์ ๊ทผ์ ์๋ํด์ ์ญ์ ์๋
import boto3
# AWS SNS ํด๋ผ์ด์ธํธ ์์ฑ
sns_client = boto3.client('sns')
# SNS ์ฃผ์ ARN
topic_arn = 'arn:aws:sns:us-east-1:123456789012:MyTopic'
# SNS ์ฃผ์ ์ ๊ตฌ๋
๋ชฉ๋ก ๊ฐ์ ธ์ค๊ธฐ
response = sns_client.list_subscriptions_by_topic(TopicArn=topic_arn)
# ๊ตฌ๋
๋ชฉ๋ก์์ PendingConfirmation ์ํ์ ๊ตฌ๋
์ฐพ๊ธฐ ๋ฐ ์ญ์
for subscription in response['Subscriptions']:
if subscription['SubscriptionArn'] == 'PendingConfirmation':
print(f"PendingConfirmation - Endpoint: {subscription['Endpoint']}")
# ๊ตฌ๋
์ญ์
sns_client.unsubscribe(SubscriptionArn=subscription['SubscriptionArn'])
print("Done")
๋ณธ์ธ์ CloudShell๋ก ๋ฐ๋ก ์ ๊ทผํด์ ์คํฌ๋ฆฝํธ๋ฅผ ์คํํ๋ค.
์ ์คํฌ๋ฆฝํธ๋ฅผ ์คํํ๋ฉด
Traceback (most recent call last):
File "/home/cloudshell-user/delete_sub.py", line 12, in <module>
sns_client.unsubscribe(SubscriptionArn=subscription['SubscriptionArn'])
File "/usr/local/lib/python3.9/site-packages/botocore/client.py", line 565, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/usr/local/lib/python3.9/site-packages/botocore/client.py", line 1021, in _make_api_call
raise error_class(parsed_response, operation_name)
botocore.errorfactory.InvalidParameterException: An error occurred (InvalidParameter) when calling the Unsubscribe operation: Invalid parameter: SubscriptionArn Reason: An ARN must have at least 6 elements, not 1
์ญ์ ํ๋ ค๋ Subscription์ ARN์ด ์๋ง์ง ์๋ค๋ ๊ฒ์ด๋ค.
๊ทธ ๋ง์ ์ฆ, status๊ฐ Pending confirmation์ธ subscription์ ์ญ์ ๊ฐ ๋ถ๊ฐ๋ฅํ๋ค๋ ๋ง์ด๋ค
ํ์ง๋ง ์ Pending confirmation์ ๊ณ์ ๊ฐ์ง๊ณ ๊ฐ ์๋ ์๋ ์ผ
3. AWS Support ๋ฌธ์
AWS Support์ ๋ฌผ์ด๋ดค๋ค.
๊ทผ๋ฐ ...........................................
์ญ์ ์ฌ๋์ ๊ณต์๋ฌธ์๋ฅผ ๋ด์ผํด ...
Amazon SNS, ์ด์ ํ์ธ๋์ง ์์ ๊ตฌ๋ ์ ๋ ๋น ๋ฅธ ์๋ ์ญ์ ์ง์
์ด์ Amazon Simple Notification Service(SNS)์์๋ ํ์ธ๋์ง ์์ ๊ตฌ๋ ์ด 48์๊ฐ ๋์ ํ์ธ ๋ณด๋ฅ ์ํ์ ์์ผ๋ฉด ํด๋น ๊ตฌ๋ ์ ์๋ ์ญ์ ํ ์ ์๋๋ก ์ง์ํฉ๋๋ค. ๋ฐ๋ผ์ ์ด์ ์ 72์๊ฐ์ด๋ ํ์ธ๋์ง ์์
aws.amazon.com
์ฌ๊ธฐ ๋ค์ด๊ฐ์ ๋ณด๋ฉด ...
๊ตฌ๋
์์ ์๊ฐ ๊ตฌ๋
์ ํ์ธํ์ง ๋ชปํ๋ ๊ฒฝ์ฐ Amazon SNS๋ ํ์ธ๋์ง ์์ ๊ตฌ๋
์ ์๋์ผ๋ก ์ ๊ฑฐํฉ๋๋ค.
ํ์ธ๋์ง ์์ ๊ตฌ๋
์ 48์๊ฐ ์ญ์ ๊ธฐ๋ฅ์ AWS GovCloud(๋ฏธ๊ตญ) ๋ฆฌ์ ์ ๋น๋กฏํ ๋ชจ๋ AWS ๋ฆฌ์ ์์ ์ฌ์ฉํ ์ ์์ต๋๋ค.
email ํ์ธ์ด ์ด๋ฃจ์ด์ง์ง ์์ผ๋ฉด 48์๊ฐ ๋ค์ ์๋ ์ญ์ ๋๋ค.
๋๋ ์๋ ์ญ์ ๋๋ ๊ฒ์ ์ง์ ์ญ์ ํ๊ฒ ๋ค๊ณ ์ด์ฌํ ๋ ธ๋ ฅํ๋ค ใ ใ ใ ใ ใ
์ด๋ ๊ฒ ๋ฐฐ์ ์ต๋๋ค.
๊ณต์๋ฌธ์ ์ ์ฝ๊ฒ ์ต๋๋ค ๐