1. AWS Console에서 Kinesis 창으로 이동하고 Create Data Stream 버튼을 누릅니다.
2. Data Stream 이름, Shard 수 입력 후 생성합니다.
온디맨드 용량 모드를 사용하면 데이터 스트림에서 쓰고 읽는 데이터의 GB당 비용을 지불하게 되고 프로비저닝된 용량 모드에서는 쓰기 및 읽기 요청 속도를 기반으로 애플리케이션에 필요한 샤드 수를 지정합니다. 샤드는 1MB/초의 쓰기와 2MB/초의 읽기를 제공하는 용량 단위입니다.
Fluent Bit Configuration
3. Fluent Bit이 Kinesis로 데이터를 보낼 수 있게 IAM role을 생성합니다.
MGMD_PUB_ROLE_NAME=$(aws cloudformation describe-stack-resources --stack-name eksctl-eksapp-nodegroup-managed-ng-public-01 | jq -r '.StackResources[] | select(.ResourceType=="AWS::IAM::Role") | .PhysicalResourceId')
echo "export MGMD_PUB_ROLE_NAME=${MGMD_PUB_ROLE_NAME}" | tee -a ~/.bash_profile
test -n "$MGMD_PUB_ROLE_NAME" && echo MGMD_PUB_ROLE_NAME is "$MGMD_PUB_ROLE_NAME" || echo MGMD_PUB_ROLE_NAME is not set
MGMD_PRI_ROLE_NAME=$(aws cloudformation describe-stack-resources --stack-name eksctl-eksapp-nodegroup-managed-ng-private-01 | jq -r '.StackResources[] | select(.ResourceType=="AWS::IAM::Role") | .PhysicalResourceId')
echo "export MGMD_PRO_ROLE_NAME=${MGMD_PRI_ROLE_NAME}" | tee -a ~/.bash_profile
test -n "$MGMD_PRI_ROLE_NAME" && echo PRI_ROLE_NAME is "$MGMD_PRI_ROLE_NAME" || echo MGMD_PRI_ROLE_NAME is not set
6. 커노드의 IAM Role에 연결합니다.
aws iam attach-role-policy \
--role-name $MGMD_PUB_ROLE_NAME \
--policy-arn arn:aws:iam::${ACCOUNT_ID}:policy/fluent-bit-policy
aws iam attach-role-policy \
--role-name $MGMD_PRI_ROLE_NAME \
--policy-arn arn:aws:iam::${ACCOUNT_ID}:policy/fluent-bit-policy
7. IAM Role이 정상적으로 배정됐는지 확인합니다.
aws iam list-attached-role-policies --role-name $MGMD_PUB_ROLE_NAME | grep fluent-bit-policy || echo 'Policy not found'
aws iam list-attached-role-policies --role-name $MGMD_PRI_ROLE_NAME | grep fluent-bit-policy || echo 'Policy not found'
8. CloudWatch의 fluent-bit-config.yaml 파일을 수정합니다.
Fluent Bit은 여러 개의 output을 설정할 수 있으니 line 133 에 주석으로 되어있는 kinesis output 코드를 추가하고 저장합니다.
[OUTPUT]
Name kinesis_streams
Match application.*
region ${AWS_REGION}
stream kds-eksapp-logging