Tag amazon-web-services

[Solved] How to connect Python consumer to AWS MSK [closed]

Using kafka-python: from kafka import KafkaConsumer if __name__ == ‘__main__’: topic_name=”example-topic” consumer = KafkaConsumer(topic_name, auto_offset_reset=”earliest”, bootstrap_servers=[‘kafka2:9092’], api_version=(0, 10), consumer_timeout_ms=1000) for msg in consumer: print(msg.value) if consumer is not None: consumer.close() from time import sleep from kafka import KafkaProducer # publish…

[Solved] Amazon s3 prices

Each time you add an object to s3, a single individual object like one file that counts as a single request So if you drag and drop 100 files it is 100 requests If runs a loop and individually sends…

[Solved] serverless events are missing

You need to add events to your functions. Have a read through the serverless documentation for events. Currently serverless supports lambdas to be invoked by API GateWay, Kinesis, DynamoDB, S3, Schedule, SNS, and Alexa Skill. (read more) So in this…

[Solved] iOS and Mechanical Turk [closed]

You shouldn’t use the Amazon API directly from your app, because in that case you would need to distribute your AWS access key & secret with the app. (I’ll let you figure out why this would be bad thing) You…

[Solved] Time to upload 100GB to Amazon Glacier

This would depend upon the speed of your Internet connection. While AWS might throttle your access to the service, your Internet connection is likely to be the biggest bottleneck. The best way to know is to upload some data (eg…

[Solved] How to set up subdomain on AWS [closed]

Well, not sure I fully understand what you are trying to do, but if you have ‘main’ and ‘admin’ running on two separate servers (behind elastic IP), you can easily create main.example.com and admin.example.com by adding example.com nameservers to Route53…

[Solved] Count Running and Stopped Ec2 Instances with AWS Lambda

Here’s some code that retrieves a list of instances and count the number of stopped and running instances: import boto3 def lambda_handler(event, context): ec2_resource = boto3.resource(‘ec2’) instances = [instance.state[“Name”] for instance in ec2_resource.instances.all()] print(‘Running: ‘, instances.count(‘running’)) print(‘Stopped: ‘, instances.count(‘stopped’)) The…