DynamoDB에 batch_write_item을 하기 위해 csv를 생성해야하는데 아래의 조건에 맞도록 해서 products.csv 파일을 생성하는 파이썬 코드를 구성해줘
- DynamoDB 요구사항
id,name,price
Markdown
복사
현재 GET 요청에서 다음과 같이 요청이 들어오는데
{
"Name": "BlockNonKoreaCountry",
"Priority": 2,
"Statement": {
"NotStatement": {
"Statement": {
"GeoMatchStatement": {
"CountryCodes": ["KR"]
}
}
}
},
"Action": {
"Block": {
"CustomResponse": {
"ResponseCode": 403,
"CustomResponseBodyKey": "error-text"
}
}
},
"VisibilityConfig": {
"SampledRequestsEnabled": true,
"CloudWatchMetricsEnabled": true,
"MetricName": "BlockNonKoreaCountry"
}
}
~을 하는 WAF Rule을 JSON으로 구성해줘 아래의 코드를 참고해서 비슷한 형식으로 작성해줘
Markdown
복사
현재 POST 요청에서 다음과 같이 요청이 들어오는데
~을 하는 WAF Rule을 JSON으로 구성해줘 아래의 코드를 참고해서 비슷한 형식으로 작성해줘
{
"Name": "BlockStatusMessage",
"Priority": 1,
"Statement": {
"AndStatement": {
"Statements": [
{
"ByteMatchStatement": {
"SearchString": "/v1/user",
"FieldToMatch": {
"UriPath": {}
},
"TextTransformations": [
{
"Priority": 0,
"Type": "NONE"
}
],
"PositionalConstraint": "EXACTLY"
}
},
{
"ByteMatchStatement": {
"SearchString": "POST",
"FieldToMatch": {
"Method": {}
},
"TextTransformations": [
{
"Priority": 0,
"Type": "NONE"
}
],
"PositionalConstraint": "EXACTLY"
}
},
{
"ByteMatchStatement": {
"SearchString": "<특정문자열>",
"FieldToMatch": {
"JsonBody": {
"MatchPattern": {
"IncludedPaths": [
"/status_message"
]
},
"MatchScope": "VALUE",
"InvalidFallbackBehavior": "MATCH",
"OversizeHandling": "CONTINUE"
}
},
"TextTransformations": [
{
"Priority": 0,
"Type": "LOWERCASE"
}
],
"PositionalConstraint": "CONTAINS"
}
}
]
}
},
"Action": {
"Block": {
"CustomResponse": {
"ResponseCode": 403,
"CustomResponseBodyKey": "error-text"
}
}
},
"VisibilityConfig": {
"SampledRequestsEnabled": true,
"CloudWatchMetricsEnabled": true,
"MetricName": "BlockStatusMessage"
}
}
Markdown
복사
