Skip to content

Instantly share code, notes, and snippets.

@yuvalif
Last active July 16, 2021 06:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuvalif/edb49b322f633e4eb19357c42cbecf74 to your computer and use it in GitHub Desktop.
Save yuvalif/edb49b322f633e4eb19357c42cbecf74 to your computer and use it in GitHub Desktop.
  • start vstart cluster:
MON=1 OSD=1 MDS=0 MGR=0 RGW=1 ../src/vstart.sh -n -d
  • run elasticserach in a container:
podman run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.13.2
  • create a topic pointing to the desired index in elasticserach:
aws --endpoint-url http://localhost:8000 sns create-topic --name=cattopic \
  --attributes='{"push-endpoint": "http://localhost:9200/cattopic/_doc/"}'

in the above example, we used the same name for the RGW bucket notifications topic and the elasticsearch index, but they can be different.

  • create a bucket:
aws --endpoint-url http://localhost:8000 s3 mb s3://cat
  • create a notification for the above topic and bucket:
aws --region=default --endpoint-url http://localhost:8000 s3api put-bucket-notification-configuration  --bucket cat \
  --notification-configuration='{"TopicConfigurations": [{"Id": "notif", "TopicArn": "arn:aws:sns:default::cattopic", "Events": []}]}'
  • upload an object to the bucket:
aws --endpoint-url http://localhost:8000 s3 cp myfile s3://cat
  • verify that the notification is in elasticsearch:
curl -XGET localhost:9200/cattopic/_search
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment