This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# When sourced, this script will export the AWS_ACCESS_KEY_ID and | |
# AWS_SECRET_ACCESS_KEY env vars from a specific profile in | |
# ~/.aws/credentials. | |
# It will also set AWS_PROFILE and AWS_DEFAULT_PROFILE, ensuring | |
# the current shell is configured to use the correct AWS credentials | |
# regardless of what script or tools you are using to connect to AWS... | |
# boto, aws cli, ansible etc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from kafka import KafkaProducer, KafkaConsumer | |
BOOTSTRAP_SERVERS=os.gentenv("KAFKA_BOOTSTRAP_SERVERS").split(",") | |
TOPIC_NAME="the-topic" | |
SASL_USERNAME=os.gentenv("KAFKA_SASL_USERNAME") | |
SASL_PASSWORD=os.gentenv("KAFKA_SASL_PASSWORD") | |
def consume(): | |
consumer = KafkaConsumer(TOPIC_NAME, security_protocol="SASL_SSL", sasl_mechanism="SCRAM-SHA-512", sasl_plain_username=SASL_USERNAME, sasl_plain_password=SASL_PASSWORD, bootstrap_servers=BOOTSTRAP_SERVERS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker/image:name |