

AWS Access Key ID [None]: <AWS Access Key 입력>
AWS Secret Access Key [None]: <AWS Secret Key 입력>
Default region name [None]: ap-northeast-2 # 서울
Default output format [None]: json
• 제목(문자열): 책 의 제목
• 저자(문자열): 책 의 저자
• 카테고리(문자열): 역사, 전기, SF 등 책의 카테고리
• 형식(지도): 판매 가능한 다양한 형식(예: 하드커버, 페이퍼백, 오디오북)과
재고 시스템에서 해당 항목 번호
import boto3
# boto3는AWS SDK for Python입니다.
client = boto3.client('dynamodb', region_name='ap-northeast-2') # 서울 리전
try:
resp = client.create_table(
TableName="Books",
KeySchema=[
{
"AttributeName": "Author",
"KeyType": "HASH" # Partition Key
},
{
"AttributeName": "Title",
"KeyType": "RANGE" # Sort Key
}
],
AttributeDefinitions=[
{
"AttributeName": "Author",
"AttributeType": "S" # String
},
{
"AttributeName": "Title",
"AttributeType": "S" # String
}
],
ProvisionedThroughput={
"ReadCapacityUnits": 1,
"WriteCapacityUnits": 1
}
)
print("Table created successfully!")
except Exception as e:
print("Error creating table:")
print(e)
partiqlbatch.json 파일로 만들기[
{
"Statement": "INSERT INTO \"Books\" VALUE {'Author':'Antje Barth','Title':'Data Science on
AWS','Category':'Technology','Formats':{'Hardcover':'J4SUKVGU','Paperback':'D7YF4FCX'}}"
},
{
"Statement": "INSERT INTO \"Books\" VALUE {'Author':'Julien Simon','Title':'Learn Amazon
SageMaker','Category':'Technology','Formats':{'Hardcover':'Q7QWE3U2','Paperback':'ZVZAYY
4F','Audiobook':'DJ9KS9NM'}}"
},
{
"Statement": "INSERT INTO \"Books\" VALUE {'Author':'James Patterson','Title':'Along Came
a
Spider','Category':'Suspense','Formats':{'Hardcover':'C9NR6RJ7','Paperback':'37JVGDZG','Au
diobook':'6348WX3U'}}"
},
{
"Statement": "INSERT INTO \"Books\" VALUE {'Author':'Dr. Seuss','Title':'Green Eggs and
Ham','Category':'Children','Formats':{'Hardcover':'GVJZQ7JK','Paperback':'A4TFUR98','Audiob
ook':'XWMGHW96'}}"
},
{
"Statement": "INSERT INTO \"Books\" VALUE {'Author':'William
Shakespeare','Title':'Hamlet','Category':'Drama','Formats':{'Hardcover':'GVJZQ7JK','Paperbac
k':'A4TFUR98','Audiobook':'XWMGHW96'}}"
}
]
aws configure list

import boto3
dynamodb = boto3.client('dynamodb', region_name='ap-northeast-2')
resp = dynamodb.execute_statement(Statement='SELECT * FROM Books WHERE
Author = \'Antje Barth\' AND Title = \'Data Science on AWS\'')
print(resp['Items'])
SELECT * FROM Books WHERE Author = 'Antje Barth' AND Title = 'Data Science on AWS' 과 동치