Skip to content

Instantly share code, notes, and snippets.

@weizhou2273
Last active August 9, 2017 03:53
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 weizhou2273/4526154039ec54f326a9dabda0a5474d to your computer and use it in GitHub Desktop.
Save weizhou2273/4526154039ec54f326a9dabda0a5474d to your computer and use it in GitHub Desktop.
import boto3
from moto import mock_kinesis
import credentials
import sys
from botocore.exceptions import ClientError
aws_key_id = credentials.aws['key_id']
aws_key = credentials.aws['key']
def create_stream(client, stream_name):
return client.create_delivery_stream(
DeliveryStreamName=stream_name ,
S3DestinationConfiguration={
'RoleARN': 'arn:aws:iam::52890735XXXX:role/firehose_delivery_role',
'BucketARN': 'arn:aws:s3:::project4capstones3',
'Prefix': stream_name+'//'
}
)
def main(search_name):
stream_name = search_name[0]
client = boto3.client('firehose', region_name='us-east-1',
aws_access_key_id=aws_key_id,
aws_secret_access_key=aws_key
)
try:
create_stream(client,search_name)
print 'Creating Kinesis stream... Please wait...'
time.sleep(60)
except:
pass
stream_status = client.describe_delivery_stream(DeliveryStreamName=stream_name)
if stream_status['DeliveryStreamDescription']['DeliveryStreamStatus'] == 'ACTIVE':
print "\n ==== KINESES ONLINE ===="
if __name__ == '__main__':
main(sys.argv[1:])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment