Tear down
Progress checklist
Overview
Section titled “Overview”An active delivery continues to process records and incur charges until you delete it. Already delivered objects keep costing S3 storage until the bucket is emptied. Stop the always-on producer before deleting the channel.
producer (rule → Lambda → role → log group) → delete-channel → empty bucket → delete bucket → delete-stream → delete delivery role-
Stop the always-on producer (if you started it), including its log group.
Terminal window export PRODUCER_RULE="kds-s3-demo-${LAB_SUFFIX}-producer-schedule"export PRODUCER_FN="kds-s3-demo-${LAB_SUFFIX}-producer"export PRODUCER_ROLE="kds-s3-demo-${LAB_SUFFIX}-producer-role"aws events remove-targets --rule "$PRODUCER_RULE" --ids 1aws events delete-rule --name "$PRODUCER_RULE"aws lambda delete-function --function-name "$PRODUCER_FN"aws iam delete-role-policy \--role-name "$PRODUCER_ROLE" \--policy-name "${PRODUCER_ROLE}-kinesis"aws iam delete-role --role-name "$PRODUCER_ROLE"aws logs delete-log-group --log-group-name "/aws/lambda/${PRODUCER_FN}" -
Delete the channel first.
Terminal window aws kinesis delete-channel --channel-arn "$CHANNEL_ARN" -
Empty and delete the destination bucket.
Terminal window aws s3 rm "s3://${BUCKET_NAME}" --recursiveaws s3api delete-bucket --bucket "$BUCKET_NAME" -
Delete the stream.
Terminal window aws kinesis delete-stream \--stream-name "$STREAM_NAME" \--enforce-consumer-deletion -
Detach the inline policy and delete the delivery role.
Terminal window aws iam delete-role-policy \--role-name "$ROLE_NAME" \--policy-name "${ROLE_NAME}-s3"aws iam delete-role --role-name "$ROLE_NAME"Or run the guarded wrapper (confirms with the lab suffix; removes producer + stack):
Terminal window ./scripts/demo.sh downLooks like (verified in
ap-southeast-2, CLI 2.36.38 — confirm with the storedLAB_SUFFIX):This will delete lab resources with prefix kds-s3-demo-LAB_SUFFIX-:producer rule kds-s3-demo-LAB_SUFFIX-producer-scheduleproducer function kds-s3-demo-LAB_SUFFIX-producerproducer role kds-s3-demo-LAB_SUFFIX-producer-rolechannel arn:aws:kinesis:ap-southeast-2:ACCOUNT_ID:channel/CHANNEL_IDbucket s3://kds-s3-demo-LAB_SUFFIX-ACCOUNT_IDstream kds-s3-demo-LAB_SUFFIX-streamrole kds-s3-demo-LAB_SUFFIX-roleType the lab suffix 'LAB_SUFFIX' to confirm: LAB_SUFFIX…Teardown requested. State file removed. Confirm with the cleanup checklist.
Verify
Section titled “Verify”Sweep with the cleanup checklist. Nothing with the
kds-s3-demo- prefix should remain. After a successful down, describe-channel /
describe-stream-summary return ResourceNotFoundException.