Which solution meets these requirements MOST cost-effectively?
Deploy an Amazon EC2 instance with a Linux operating system. Configure a cron job to run the script every 2 minutes. Extend the script to store the JSON object along with the timestamp in a MySQL database that is hosted on an Amazon RDS DB instance.
Deploy an Amazon EC2 instance with a Linux operating system to extend the script to run in an infinite loop every 2 minutes. Store the JSON object along with the timestamp in an Amazon DynamoDB table that uses the timestamp as the primary key. Run the script on the EC2 instance.
Deploy an AWS Lambda function to extend the script to store the JSON object along with the timestamp in an Amazon DynamoDB table that uses the timestamp as the primary key. Use an Amazon EventBridge (Amazon CloudWatch Events) scheduled event that is initiated every 2 minutes to invoke the Lambda function.
Deploy an AWS Lambda function to extend the script to run in an infinite loop every 2 minutes. Store the JSON object along with the timestamp in an Amazon DynamoDB table that uses the timestamp as the primary key. Ensure that the script is called by the handler function that is configured for the Lambda function.
Explanations:
This option involves deploying an EC2 instance, which incurs costs associated with running a virtual server. The solution also uses a cron job and MySQL on Amazon RDS, which adds complexity and additional costs related to database management and operation, making it less cost-effective for this use case.
Similar to Option A, this option also requires an EC2 instance, which is not necessary given the workload. Running the script in an infinite loop is inefficient and can lead to increased costs due to continuous resource usage. While DynamoDB can be a cost-effective storage option, the EC2 overhead makes this solution less optimal.
This option utilizes AWS Lambda, which is a serverless compute service, eliminating the need for a continuously running EC2 instance. The Lambda function can be triggered every 2 minutes via Amazon EventBridge, which efficiently handles scheduled tasks. Storing the JSON in DynamoDB provides a scalable and cost-effective solution. This setup minimizes operational costs and resource management.
This option suggests running the Lambda function in an infinite loop, which is not how Lambda is intended to be used. Lambda is billed based on the number of invocations and the duration of execution; using it in a loop would lead to unnecessary invocations and increased costs. Thus, this approach is inefficient and incorrect for the given requirements.