Skip to content

aws-cloud-clubs/ACC-Pillars

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

25 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“ง ์ด๋ฉ”์ผ ๋Œ€๋Ÿ‰ ๋ฐœ์†ก ์‹œ์Šคํ…œ ์„ค๊ณ„

๐Ÿ”— Requirements

  • ๋งค์ผ ์ตœ๋Œ€ 500๊ฑด์˜ ์ด๋ฉ”์ผ ๋Œ€๋Ÿ‰ ๋ฐœ์†ก ํ•„์š”
  • ์ด๋ฉ”์ผ๋‹น ํ‰๊ท  ํฌ๊ธฐ๋Š” 100KB ์˜ˆ์ƒ
  • ์ด๋ฉ”์ผ ๋ฐœ์†ก ์ง€์—ฐ ์‹œ๊ฐ„์€ 5๋ถ„ ์ด๋‚ด
  • ๋ฐœ์†ก ์‹คํŒจ ์ฒ˜๋ฆฌ: ์‹คํŒจํ•œ ์ด๋ฉ”์ผ์— ๋Œ€ํ•œ ์ž๋™ ์žฌ์‹œ๋„ ๋กœ์ง (์ตœ๋Œ€ 3ํšŒ)
  • ๊ตฌ๋… ๊ด€๋ฆฌ: ์‚ฌ์šฉ์ž๋ณ„ ์ด๋ฉ”์ผ ์ˆ˜์‹  ์„ค์ • ๋ฐ ๊ตฌ๋… ํ•ด์ง€ ๊ธฐ๋Šฅ
  • ์ŠคํŒธ ๋ฐฉ์ง€: SES์˜ SPF๋ฅผ ํ†ตํ•œ ๋„๋ฉ”์ธ ์ธ์ฆ

๐Ÿ”— User Scenarios

  • ๋ฌด์‹ ์‚ฌ ๋งˆ์ผ€ํŒ… ์ง์› A์”จ๊ฐ€ ๊ณ ๊ฐ 200๋ช…์—๊ฒŒ ๋งž์ถคํ˜• ํ™๋ณด ์ด๋ฉ”์ผ ์ „์†ก

๐Ÿ‘ฅ Team members

๋ฐ•์–ธ์„  ๊น€์ง€์› ๋ฐ•๊ฐ€์˜ ์ด๋™์ค€ ์ •ํ˜„์„ ํ™ฉ๊ทœ๋ฆฌ
profile profile profile profile profile profile
eonpark JiwonKim08 ParkIsComing dongjune8931 Junghs21 gyuuuuri

โœจ Technology Stack


โ” AWS Services Usage Explanations

Lambda

  • 15๋ถ„์˜ Lambda ์‹คํ–‰ ์‹œ๊ฐ„์˜ ์ œ์•ฝ ๋ฐœ์ƒ
  • but, Serverless ํ™˜๊ฒฝ์˜ ์žฅ์ ์„ ์‚ฌ์šฉํ•˜๊ณ  ์‹ถ์Œ
  • StepFunction ๋„์ž…

StepFunction

  • Map์„ ์‚ฌ์šฉํ•ด ๋™์ผํ•œ ์›Œํฌํ”Œ๋กœ์šฐ(์˜ˆ: Lambda ํ•จ์ˆ˜ ํ˜ธ์ถœ)๋ฅผ ๋ณ‘๋ ฌ๋กœ ์‹คํ–‰
  • ์ „์ฒด ์‹คํ–‰์‹œ๊ฐ„์„ ๋‹จ์ถ• & ๋ณต์žกํ•œ ๋ฐ˜๋ณต ๋กœ์ง์„ ๊ฐ„๊ฒฐํ•˜๊ฒŒ ์ฒ˜๋ฆฌ
  • ์ด๋ฉ”์ผ์ด ๋Š˜์–ด๋‚ ์ˆ˜๋ก ์ฒ˜๋ฆฌ์†๋„ ์ƒ์Šน

Email Verification(sandbox)

  • SES Sandbox๋กœ ์ธํ•ด '์ผ์ผ ์ตœ๋Œ€ 200๊ฐœ๋ผ๋Š” ํ•œ๋„', '์ธ์ฆ๋œ ์ด๋ฉ”์ผ๋กœ๋งŒ ์ „์†ก' ๋“ค๋กœ ์ธํ•ด ํ”„๋กœ์ ํŠธ ๋ชฉ์  ๋‹ฌ์„ฑ์— ์ œ์•ฝ ๋ฐœ์ƒ
  • ์ƒŒ๋“œ๋ฐ•์Šค ํ•ด์ œํ•˜์—ฌ ๋ฌธ์ œ ํ•ด๊ฒฐ
    • ํ”„๋กœ๋•์…˜ ํ™˜๊ฒฝ์œผ๋กœ ์ „ํ™˜๋˜์–ด ์ˆ˜์‹ ์ž์˜ ์ฃผ์†Œ ๋˜๋Š” ๋„๋ฉ”์ธ์ด ํ™•์ธ๋˜์—ˆ๋Š”์ง€ ์—ฌ๋ถ€์— ๊ด€๊ณ„์—†์ด ๋ชจ๋“  ์ˆ˜์‹ ์ž์—๊ฒŒ ์ด๋ฉ”์ผ์„ ๋ณด๋‚ผ ์ˆ˜ ์žˆ์Œ
    • ์ผ์ผ ์ตœ๋Œ€ 200๊ฐœ ๋ฆฌ๋ฐ‹ ๋ฒ—์–ด๋‚จ.
  • Request production access์„ ํ•˜๊ธฐ ์œ„ํ•ด ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๋‚ด์šฉ์„ ์ž‘์„ฑํ•ด์„œ ์‹ ์ฒญ
    • ๋ฉ”์ผ ๋ฐœ์†ก ๋ชฉ๋ก์„ ์–ด๋–ป๊ฒŒ ์ž‘์„ฑํ•˜๊ฑฐ๋‚˜ ๋งŒ๋“ค ๊ณ„ํš
    • ๋ฐ˜์†ก ๋ฉ”์ผ๊ณผ ์ˆ˜์‹  ๊ฑฐ๋ถ€๋ฅผ ์–ด๋–ป๊ฒŒ ์ฒ˜๋ฆฌํ•  ๊ณ„ํš
    • ์ˆ˜์‹ ์ž๊ฐ€ ๊ท€ํ•˜๊ฐ€ ๋ณด๋‚ด๋Š” ์ด๋ฉ”์ผ์„ ์ˆ˜์‹  ๊ฑฐ๋ถ€ํ•˜๋Š” ๋ฐฉ๋ฒ•
    • ์ด ์š”์ฒญ์—์„œ ๊ท€ํ•˜๊ฐ€ ์ง€์ •ํ•œ ์†ก์‹ ๋ฅ  ๋˜๋Š” ๋ฐœ์‹  ํ• ๋‹น๋Ÿ‰

DynamoDB

  • ํŒ€์›๋“ค ๋ชจ๋‘ RDS๋ฅผ ์‚ฌ์šฉํ•ด๋ณธ ๊ฒฝํ—˜์ด ์žˆ์œผ๋ฏ€๋กœ ์ƒˆ๋กœ์šด DB์ธ NoSQL์„ ์‚ฌ์šฉํ•˜๊ณ ์ž ์„ ํƒํ•จ
  • ์™„์ „ ๊ด€๋ฆฌํ˜• ์„œ๋น„์Šค์ด๋ฏ€๋กœ ์šด์˜ ๋ถ€๋‹ด์ด ๋ฐœ์ƒํ•˜์ง€ ์•Š์Œ
  • key-value ํ˜•ํƒœ์ด๋ฏ€๋กœ READ ์†๋„๊ฐ€ ๋น ๋ฆ„
  • ๋ฐ์ดํ„ฐ ์–‘์ด ๋Š˜์–ด๋‚˜๋ฉด ์„œ๋ฒ„๋ฅผ ์ฆ์„คํ•˜๋Š” ์ˆ˜ํ‰์  ํ™•์žฅ์„ ํ†ตํ•ด ์„ฑ๋Šฅ ์œ ์ง€ ๊ฐ€๋Šฅ

๐Ÿ›  Overall Project Structure Diagram

AWS ๊ตฌ์กฐ๋„

๐Ÿ›  Structure Diagram Explanations

emailprocess

  • ์‹ค์ œ ์ด๋ฉ”์ผ์€ sandbox๋ฅผ ํ•ด์ œํ•˜์ง€ ์•Š๋Š” ์ด์ƒ AWS ๊ณ„์ •๋‹น ๋ฉ”์ผ 200๊ฐœ๋งŒ์„ ๋ณด๋‚ผ ์ˆ˜ ์žˆ๊ธฐ์—, ์‹คํ–‰ ์˜ˆ์‹œ๋Š” 200๊ฐœ๋ฅผ ๊ธฐ์ค€์œผ๋กœ ํ•จ
  • DynamoDB์— ์žˆ๋Š” ์ „์ฒด ์œ ์ € 200๋ช…์—๊ฒŒ ์ด๋ฉ”์ผ์„ ๋ณด๋‚ธ๋‹ค๊ณ  ๊ฐ€์ •
  • Lambda(1)์—์„œ dynamoDB๋กœ๋ถ€ํ„ฐ 10๋ช…์˜ ์œ ์ € ์ •๋ณด๋ฅผ ๊ฐ€์ ธ์˜ด
  • ๊ทธ ํ›„ Lambda(2)๋ฅผ ํ˜ธ์ถœํ•ด 10๋ช…์˜ ์œ ์ € payload์™€ ํ…œํ”Œ๋ฆฟ ์ •๋ณด๋ฅผ SQS๋กœ ์ „๋‹ฌ (*SQS๋ฅผ ๊ฑฐ์น˜๋Š” ์ด์œ ๋Š” ์ด๋ฉ”์ผ ๋ˆ„๋ฝ์„ ๋ง‰๊ธฐ ์œ„ํ•จ)
  • Lambda(3)์—์„œ 10๋ช…์˜ ์œ ์ € payload๋ฅผ ๊ฐ€์ ธ์™€ ํ…œํ”Œ๋ฆฟ์— ์‚ฝ์ž…ํ•˜์—ฌ ์ด๋ฉ”์ผ์„ ์™„์„ฑํ•œ ํ›„, SES๋กœ ์ด๋ฉ”์ผ์„ ์ „์†ก
  • 200๊ฐœ์˜ ์ด๋ฉ”์ผ์„ ์ „์†กํ•˜๊ธฐ ์œ„ํ•ด ์œ„ ๊ณผ์ •์„ 20๋ฒˆ ๋ฐ˜๋ณต (10*20 = 200๊ฐœ์˜ ์ด๋ฉ”์ผ)

๐Ÿ›  StepFunction Map Flow

stepfunction flow

๐Ÿ›  AWS SES

AWS SES(Amazon Simple Email Service)๋Š” ๋Œ€๋Ÿ‰์œผ๋กœ ์ด๋ฉ”์ผ์„ ์ „์†กํ•  ์ˆ˜ ์žˆ๋Š” ํด๋ผ์šฐ๋“œ ์ด๋ฉ”์ผ ์„œ๋น„์Šค ๊ณต๊ธ‰์ž

  • ๋น„์šฉ ํšจ์œจ์„ฑ: ์‚ฌ์šฉํ•œ ๋งŒํผ๋งŒ ๋น„์šฉ์„ ์ง€๋ถˆํ•˜์—ฌ ๊ฒฝ์ œ์ 
  • ์ž๋™ ์Šค์ผ€์ผ๋ง: ์ด๋ฉ”์ผ ๋ฐœ์†ก ํฌ๊ธฐ๊ฐ€ ์ž๋™์œผ๋กœ ์Šค์ผ€์ผ๋ง๋˜์–ด ์œ ์—ฐํ•˜๊ฒŒ ๋Œ€์‘
  • ์ƒ์„ธํ•œ ๋กœ๊ทธ์™€ ๋ณด๊ณ ์„œ: ์ „์†ก๋œ ์ด๋ฉ”์ผ์— ๋Œ€ํ•œ ์ƒ์„ธํ•œ ๋กœ๊ทธ์™€ ๋ณด๊ณ ์„œ๋ฅผ ์ œ๊ณตํ•˜์—ฌ, ๋‹ค๋ฅธ ์„œ๋น„์Šค์˜ ๊ธฐ์ค€๊ฐ’์œผ๋กœ ํ™œ์šฉ ๊ฐ€๋Šฅ

๋„๋ฉ”์ธ & ์ด๋ฉ”์ผ ์ฃผ์†Œ ์ธ์ฆ

  • ๋„๋ฉ”์ธ ๊ตฌ๋งค: ๊ฐ€๋น„์•„์—์„œ ๋„๋ฉ”์ธ์„ ๊ตฌ๋งคํ•˜์—ฌ ์‚ฌ์šฉ

  • DKIM ์ธ์ฆ: SES์—์„œ ์ œ๊ณตํ•˜๋Š” **DKIM(DomainKeys Identified Mail)**์˜ CNAME ๋ ˆ์ฝ”๋“œ๋ฅผ ๊ฐ€๋น„์•„์˜ ๋„๋ฉ”์ธ DNS ์„ค์ •์— ์ถ”๊ฐ€

    ๋ชฉ์ : ์ด๋ฉ”์ผ ์ „์†ก ์‹œ, ๋„๋ฉ”์ธ์ด ์‹ค์ œ๋กœ ๋‚ด ๊ฒƒ์ž„์„ ์ฆ๋ช…ํ•˜๊ณ , ์ด๋ฉ”์ผ์ด ์ŠคํŒธ์œผ๋กœ ๋ถ„๋ฅ˜๋˜๋Š” ๊ฒƒ์„ ๋ฐฉ์ง€

์ž๊ฒฉ ์ฆ๋ช…

๐ŸŽฏ Lambda Explanations

StepFunction ๋‚ด Lambda ๋ณ„ ๊ธฐ๋Šฅ ๋ฐ Input/Output

Lambda(1) Lambda(2) Lambda(3)
๋ชฉ์  ์œ ์ €๋ฆฌ์ŠคํŠธ n๊ฐœ์”ฉ ๊ฐ€์ ธ์˜ด payload๋ฅผ ํ๋กœ n๊ฐœ์”ฉ ์ „์†ก SQS์—์„œ SES๋กœ ์ด๋ฉ”์ผ ์ „์†ก
Input ์œ ์ €๋ฆฌ์ŠคํŠธ chunk (ํฌ๊ธฐ: n๊ฐœ) (DynamoDB์—์„œ ์œ ์ € ๋ฐ์ดํ„ฐ ๋ช‡ ๊ฐœ ์ฝ์–ด์˜ฌ ์ง€) ์œ ์ €๋ฆฌ์ŠคํŠธ ๋ฐ์ดํ„ฐ (DynamoDB์—์„œ ๊บผ๋‚ด์˜จ ์ •๋ณด) ์œ ์ € payload ๋ฆฌ์ŠคํŠธ n๊ฐœ ๋ฐฐ์น˜
Output 1. ์œ ์ €๋ฆฌ์ŠคํŠธ chunk (DynamoDB์—์„œ ๊บผ๋‚ด์˜จ ์ •๋ณด = name, email, gender, isscribing) 2. ํ…œํ”Œ๋ฆฟ ์ •๋ณด ์œ ์ € payload ๋ฆฌ์ŠคํŠธ n๊ฐœ ๋ฐฐ์น˜ (name, email, subject, body) ๋ฉ”์ผ ์™„์„ฑ๋ณธ (ํ…œํ”Œ๋ฆฟ์— ์œ ์ € payload ์‚ฝ์ž… + ๊ตฌ๋…์ทจ์†Œ๋งํฌ ์‚ฝ์ž… + S3์—์„œ ๊ฐ€์ ธ์˜จ ์ด๋ฏธ์ง€ ์‚ฝ์ž…)

-Lambda (1) - GetUserData

Output

{
"result": {
  "Payload": [
    {
      "Gender": "Male",
      "SubscriptionStatus": true,
      "Email": "[email protected]",
        "Name": "chulsu"
    },
    
      .
      .      (์ƒ๋žต)
      .
    
    
    {
      "Gender": "Female",
      "SubscriptionStatus": "true",
      "Email": "[email protected]",
      "Name": "Karen Young"
    },
  ],
  "LastEvaluatedKey": {
    "Email": "[email protected]"
  } 
}
- 10๊ฐœ์˜ ์œ ์ €๋ฐ์ดํ„ฐ output์€ map#1~map#10์— ํ•ด๋‹น
- ๋“ค๊ณ  ์˜จ ๋งˆ์ง€๋ง‰ ๋ฐ์ดํ„ฐ๋ฅผ LastEvaluatedKey ๋กœ ์ €์žฅ

-Lambda (2) - EmailQueuer

Input Output
{
  "Gender": "Female",
  "SubscriptionStatus": "true",
  "Email": "[email protected]",
  "Name": "chulsu"
}
      








{
  "statusCode": 200, "body": { "template": { "subject": "ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค!", "body": "<title>{{Subject}}</title>

์•ˆ๋…•ํ•˜์„ธ์š”, {{Name}}๋‹˜!

{{Body}}

์ง€๊ธˆ ์‡ผํ•‘ํ•˜๊ธฐ

๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค,
๋ฌด์‹ ์‚ฌ ํŒ€

์ด ๋ฉ”์ผ์€ ๋ฌด์‹ ์‚ฌ์—์„œ ๋ฐœ์†ก๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์ˆ˜์‹  ๊ฑฐ๋ถ€๋ฅผ ์›ํ•˜์‹œ๋ฉด ์—ฌ๊ธฐ๋ฅผ ํด๋ฆญํ•˜์„ธ์š”.

" }, "user": { "Email": "[email protected]", "Name": "chulsu", "Subject": "๋ฌด์‹ ์‚ฌ ํŒŒ๊ฒฉ์„ธ์ผ", "Body": "๋“ค์–ด๊ฐ€๋Š” ๋ง" } } }
- Lambda(2)์˜ ์œ„ ํฌ๋ฉง์€ map#1๋งŒ์„ ์˜๋ฏธ 
- Step Functions์˜ Map ํŠน์„ฑ์ƒ, ๋‚˜๋จธ์ง€ map#2~map#10๋„ ๋ณ‘๋ ฌ ์ฒ˜๋ฆฌ๋˜๊ณ  ์žˆ์Œ
    โ†’ SES์— ์ €์žฅํ•ด ๋‘” ํ…œํ”Œ๋ฆฟ์„ ๊ฐ€์ ธ์™€ Lambda(3)๋กœ ์˜ฎ๊น€
    โ†’ Lambda(3)๋กœ ์ด๋™ ์ „ SQS ๊ฑฐ์นจ

-Lambda (3) - EmailPayload

- ๋ฉ”์ผ ์™„์„ฑ๋ณธ์„ SES๋กœ ์ „๋‹ฌ
   -> S3์œผ๋กœ๋ถ€ํ„ฐ ์ด๋ฏธ์ง€ ์‚ฝ์ž…
   -> ๊ตฌ๋… ์ทจ์†Œ ๋งํฌ ์‚ฝ์ž…

-StepFunction

  {
    "StartAt": "Lambda (1)",
    "States": {
      "Lambda (1)": {
        "Type": "Task",
        "Resource": "arn:aws:lambda:ap-northeast-2:008971651769:function:GetUserData10",
        "ResultPath": "$.result",
        "Next": "Map"
      },
      "Map": {
        "Type": "Map",
        "ItemsPath": "$.result.Payload",
        "MaxConcurrency": 10,
        "ItemProcessor": {
          "ProcessorConfig": {
            "Mode": "INLINE"
          },
          "StartAt": "Lambda(2)",
          "States": {
            "Lambda(2)": {
              "Type": "Task",
              "Resource": "arn:aws:lambda:ap-northeast-2:008971651769:function:EmailQueuer_update",
              "Next": "Lambda (3)"
            },
            "Lambda (3)": {
              "Type": "Task",
              "Resource": "arn:aws:states:::lambda:invoke",
              "OutputPath": "$.Payload",
              "Parameters": {
                "Payload.$": "$",
                "FunctionName": "arn:aws:lambda:ap-northeast-2:008971651769:function:email_pra"
              },
              "Retry": [
                {
                  "ErrorEquals": [
                    "Lambda.ServiceException",
                    "Lambda.AWSLambdaException",
                    "Lambda.SdkClientException",
                    "Lambda.TooManyRequestsException"
                  ],
                  "IntervalSeconds": 1,
                  "MaxAttempts": 3,
                  "BackoffRate": 2
                }
              ],
              "End": true
            }
          }
        },
        "Next": "CheckForMoreData",
        "ResultPath": "$.results_test"
      },
      "CheckForMoreData": {
        "Type": "Choice",
        "Choices": [
          {
            "Variable": "$.result.LastEvaluatedKey",
            "IsPresent": true,
            "Next": "UpdateLastEvaluatedKey"
          }
        ],
        "Default": "Finish"
      },
      "UpdateLastEvaluatedKey": {
        "Type": "Pass",
        "Parameters": {
          "LastEvaluatedKey.$": "$.result.LastEvaluatedKey"
        },
        "ResultPath": "$.meta",
        "Next": "Lambda (1)"
      },
      "Finish": {
        "Type": "Succeed"
      }
    }
  }   

๐Ÿ”— Step Functions Efficiency

st0 step2 step3
  • 50๊ฐœ์˜ ์ด๋ฉ”์ผ์„ ๋ณด๋‚ด๋Š”๋ฐ ์ด 21์ดˆ ๊ฑธ๋ฆผ
  • ์ด๋ฅผ ํ‰๊ท ์œผ๋กœ ๊ณ„์‚ฐํ•˜๋ฉด 5๋ถ„ ๋™์•ˆ ๋ณด๋‚ผ ์ˆ˜ ์žˆ๋Š” ์ด๋ฉ”์ผ์˜ ๊ฐœ์ˆ˜๋Š” 750๊ฐœ

๐Ÿ”— development direction

error
  • Lambda ํ•จ์ˆ˜์—์„œ SES์— ๋ฏธ๋ฆฌ ์˜ฌ๋ ค๋†“์€ ํ…œํ”Œ๋ฆฟ์„ ๊ฐ€์ ธ์˜ค๋Š” ์ฝ”๋“œ์—์„œ ๋„ˆ๋ฌด ๋งŽ์€ API ์š”์ฒญ์œผ๋กœ ์ธํ•ด Throttling์ด ๋ฐœ์ƒ โ†’ ์ด๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด ์ฒ˜์Œ์—๋งŒ SES์—์„œ ํ…œํ”Œ๋ฆฟ์„ ๊ฐ€์ ธ์™€์„œ ElastiCache์— ๋„ฃ์–ด ์‚ฌ์šฉํ•˜๋Š” ํ˜•์‹์œผ๋กœ ์œ„์˜ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๊ณ ์ž ํ•จ

๐Ÿ›  DynamoDB ์„ค๊ณ„

[User Table]

  • ์œ ์ € ์ •๋ณด๋ฅผ ์ €์žฅํ•˜๊ธฐ ์œ„ํ•œ ํ…Œ์ด๋ธ”

Partition key

  • Email(String)
    • ์œ ์ € ์ด๋ฉ”์ผ ์ฃผ์†Œ๋ฅผ ์ €์žฅํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉ

Attributes

  • Name(String)
    • ์œ ์ € ์ด๋ฆ„์„ ์ €์žฅํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉ
  • Gender(String)
    • ํ•ด๋‹น ์œ ์ €์˜ ์„ฑ๋ณ„์„ ์ €์žฅ
  • CreateTime(์ˆซ์ž)
    • ํšŒ์›๊ฐ€์ž… ์‹œ๊ฐ„ ์ €์žฅ
  • SubscriptionStatus(๋ถ€์šธ)
    • ๊ตฌ๋… ์ƒํƒœ๋ฅผ ์ €์žฅ

[ImageAndTemplate Table]

  • ์ด๋ฉ”์ผ ํ…œํ”Œ๋ฆฟ๊ณผ ์‚ฌ์šฉํ•˜๋Š” ์ด๋ฏธ์ง€๋“ค์˜ ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅํ•˜๊ธฐ ์œ„ํ•œ ํ…Œ์ด๋ธ”

Partition key

  • TemplateID(String)
    • ์ด๋ฉ”์ผ ํ…œํ”Œ๋ฆฟ์„ ๊ณ ์œ ํ•˜๊ฒŒ ์‹๋ณ„ํ•  TemplateID

Attributes

  • ImageURLs(List)
    • ํ•ด๋‹น ํ…œํ”Œ๋ฆฟ์ด๋ž‘ ๋งคํ•‘ํ›„, s3์— ์ €์žฅ๋œ ํ•ด๋‹น ์ด๋ฏธ์ง€ ์ฃผ์†Œ
  • TemplateName(String)
    • ์ด๋ฉ”์ผ ํ…œํ”Œ๋ฆฟ ์‚ฌ์šฉ ์šฉ๋„๋ฅผ ๊ฐ„๋žตํ•˜๊ฒŒ ์ €์žฅํ•˜๊ธฐ ์œ„ํ•œ ์šฉ๋„

๐Ÿ“ฉ ์ด๋ฉ”์ผ ๋ฐœ์†ก์„ ์œ„ํ•œ ์œ ์ € ์ •๋ณด ์ฒ˜๋ฆฌ

์ดˆ๊ธฐ์— ์„œ๋น„์Šค ์šด์˜ DB์—์„œ ์œ ์ € ๋ฐ์ดํ„ฐ ๊ฐ€์ ธ์˜ค๊ธฐ

  • ์„œ๋น„์Šค ์šด์˜ DB๋กœ ๊ด€๊ณ„ํ˜• ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋‹ค๊ณ  ๊ฐ€์ •ํ•˜๊ณ , ์ด๋ฉ”์ผ ๋Œ€๋Ÿ‰ ๋ฐœ์†ก์„ ์œ„ํ•ด์„œ๋Š” ์ด๋ฉ”์ผ ๋ณด๋‚ผ ์œ ์ €์˜ ์ •๋ณด(์ด๋ฆ„, ์ด๋ฉ”์ผ, ์„ฑ๋ณ„ ๋“ฑ)๋ฅผ ๊ด€๊ณ„ํ˜• ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์—์„œ ๊ฐ€์ ธ์™€์•ผ ํ•จ
  • ๋‹ค๋ฅธ ํ…Œ์ด๋ธ”๊ณผ์˜ join ์ž‘์—…์ด ํ•„์š”ํ•˜์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์— ๋งค๋ฒˆ ์šด์˜ DB์— ์ ‘์†ํ•˜์—ฌ ๋ฉ”์ผ์„ ๋ฐœ์†กํ•  ์œ ์ € ์ •๋ณด๋ฅผ ์ฝ์–ด์˜ค๊ธฐ ๋ณด๋‹ค๋Š” ๋น ๋ฅธ Read ์ž‘์—…์ด ๊ฐ€๋Šฅํ•œ DynamoDB์— ์œ ์ € ์ •๋ณด๋ฅผ ๋‘๊ณ , ๋ฉ”์ผ์„ ๋ฐœ์†กํ•  ๋•Œ DynamoDB์—์„œ ์œ ์ € ์ •๋ณด๋ฅผ ๊ฐ€์ ธ์˜ด
  • ์ฃผ๊ธฐ์ ์œผ๋กœ ์šด์˜ DB์—์„œ ๋ณ€๋™๋œ ์œ ์ € ์ •๋ณด๋ฅผ DynamoDB์— ์—…๋ฐ์ดํŠธํ•จ์œผ๋กœ์จ ๋ฐ์ดํ„ฐ๋ฅผ ๋™์ผํ•˜๊ฒŒ ์œ ์ง€ํ•จ
  • ์ฐธ๊ณ ) ์šด์˜ DB๊ฐ€ RDS์—์„œ MySQL DB๋ฅผ ํ™œ์šฉํ•˜๊ณ  ์žˆ๋‹ค๊ณ  ๊ฐ€์ •
  • ์ดˆ๊ธฐ์—๋Š” RDS์— ์ €์žฅ๋œ ์œ ์ € ์ •๋ณด๋ฅผ S3๋ฅผ ๊ฑฐ์ณ DynamoDB์— ๊ฐ€์ ธ์˜ด
  • ์œ ์ € ์ •๋ณด๊ฐ€ ๋งŽ์€ ๊ฒฝ์šฐ์— ๋Œ€๋น„ํ•ด RDS์—์„œ DynamoDB๋กœ ํ•œ๋ฒˆ์— ๋ฐ์ดํ„ฐ๋ฅผ ์˜ฎ๊ธฐ์ง€ ์•Š๊ณ , ๋ฐ์ดํ„ฐ๋ฅผ ์—ฌ๋Ÿฌ ์ž‘์€ ๋ฉ์–ด๋ฆฌ๋กœ ๋ถ„ํ• ํ•˜์—ฌ ๋‚˜๋ˆ„์–ด ์ €์žฅ

cronjob์„ ์ด์šฉํ•œ ๋ฐ์ดํ„ฐ ๋™๊ธฐํ™”

  • ์šด์˜ DB์—์„œ ์œ ์ € ์ •๋ณด๊ฐ€ ์ถ”๊ฐ€, ๋ณ€๊ฒฝ๋˜๋ฉด์„œ DynamoDB์˜ ๋ฐ์ดํ„ฐ์™€ ๋‹ฌ๋ผ์ง€๋ฉด ์ฃผ๊ธฐ์ ์ธ polling์„ ํ†ตํ•ด ์ด๋ฅผ ์—…๋ฐ์ดํŠธ ํ•ด์ค˜์•ผ ํ•จ
  • ์ด๋ฉ”์ผ ๋ฐœ์†ก์˜ ๊ฒฝ์šฐ, ์‹ค์‹œ๊ฐ„ ๋™๊ธฐํ™”๊ฐ€ ํ•„์š”ํ•˜์ง€ ์•Š๊ณ  ๋ฐœ์†ก ์‹œ๊ฐ„์„ ๊ธฐ์ค€์œผ๋กœ ๋™๊ธฐํ™”๊ฐ€ ๋˜์–ด ์žˆ์œผ๋ฉด ๋˜๊ธฐ ๋•Œ๋ฌธ์— cronjob์„ ์ฃผ๊ธฐ์ ์ธ ๋™๊ธฐํ™”๊ฐ€ ์ด๋ฃจ์–ด์ง€๋„๋ก ์„ค์ •

๋‹จ๊ณ„

  1. ๋ฐฐ์น˜ ์ž‘์—… ์„ค์ •
    • ์ผ์ • ์‹œ๊ฐ„ ๊ฐ„๊ฒฉ(์˜ˆ: ๋งค ์‹œ๊ฐ„, ๋งค์ผ)์œผ๋กœ ์‹คํ–‰๋˜๋Š” ๋ฐฐ์น˜ ์ž‘์—…์„ ์„ค์ •
  2. ๋ฐฐ์น˜ ์ž‘์—… ์‹คํ–‰
    • EC2 ์ธ์Šคํ„ด์Šค์—์„œ ์ฃผ๊ธฐ์ ์œผ๋กœ ๋ฐฐ์น˜ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์‹คํ–‰
  3. ๋ณ€๊ฒฝ๋œ ๋ฐ์ดํ„ฐ ์ถ”์ 
    • MySQL์˜ TIMESTAMP ํƒ€์ž…์„ ์ด์šฉํ•˜๋ฉด ๋ฐ์ดํ„ฐ๊ฐ€ ์ถ”๊ฐ€ ๋ฐ ์ˆ˜์ •๋  ๋•Œ ์ž๋™์œผ๋กœ TIMESTAMP ํ•„๋“œ๊ฐ€ ์—…๋ฐ์ดํŠธ ๋จ
    • ์œ ์ € ํ…Œ์ด๋ธ”์˜ update_at ํ•„๋“œ๋ฅผ TIMESTAMP ํƒ€์ž…์œผ๋กœ ์„ค์ •ํ•˜์—ฌ ๋ณ€๊ฒฝ๋œ ๋ฐ์ดํ„ฐ๋ฅผ ์ถ”์ ํ•จ
  4. ๋ฐ์ดํ„ฐ ๋™๊ธฐํ™”
    • ๋ณ€๊ฒฝ๋œ ๋ฐ์ดํ„ฐ๋ฅผ ์ฝ์–ด์™€ DynamoDB์— ๋ฐ˜์˜ํ•จ. ์ดํ›„์—๋„ ์ฃผ๊ธฐ์ ์œผ๋กœ 2~4๋ฒˆ ๊ณผ์ •์ด ์‹คํ–‰๋จ

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages