How to achieve transaction across an AWS S3 upload and an ElasticSearch update? - spring

Problem
Is there a way to achieve transactionality between S3 and another database like ElasticSearch?
What I'm trying to do is to upload an object to S3 and save his identifier to ElasticSearch in an atomic way.
For the backend where logic exists, we are using Java with Springboot.
From AWS docs
I saw that this is a common pattern recommended by AWS, but they mention that you need to handle on our own the failures:
"You can also store the item as an object in Amazon Simple Storage Service (Amazon S3) and store the Amazon S3 object identifier in your DynamoDB item."
"DynamoDB doesn't support transactions that cross Amazon S3 and DynamoDB. Therefore, your application must deal with any failures, which could include cleaning up orphaned Amazon S3 objects."
Ref: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-use-s3-too.html

Related

How to create batch process to upload Oracle DB data to AWS Data Exchange?

I am looking for scope where i can send data from oracle db to AWS Data exchange without any manual intervention?
In January 2022, AWS Data Exchange launched support for data sets backed by Amazon Redshift; the same guide referenced by John Rotenstein, above, shows you how you can create a data set using Amazon Redshift datashares. If you are able to move data from the Oracle database to Amazon Redshift, this option may work for you.
AWS Data Exchange just announced a preview of data sets using AWS Lake Formation, which allows you to share data from your Lake Formation data lake, which has support for Oracle databases running in Amazon Relational Database Service (RDS) or hosted in Amazon Elastic Compute Cloud (EC2). Steps to create this kind of product can be found here.

How to export data from Oracle Database to AWS S3 bucket

I have a high voluminous data in my oracle database. I want to migrate it on the AWS S3 bucket. I cannot find a good documentation for this. Please share if someone has already done it.
Thanks
You can use AWS Data Pipeline
[Copied from above link]
With AWS Data Pipeline, you can regularly access your data where it’s stored, transform and process it at scale, and efficiently transfer the results to AWS services such as Amazon S3, Amazon RDS, Amazon DynamoDB, and Amazon EMR.
Also found some code on GitHub to backup Oracle data to S3 link

Sending Oracle AWS RDS logs to an S3 bucket

I'm trying to send logs from an Oracle RDS hosted in Amazon to an S3 bucket. I'd like to send logs to the S3 bucket daily.
What would be a recommended course of action to achieve this? I'm not concerned if the data is compressed or in it's original format.
I'm also relatively new to AWS so I'm not fully aware of all the features that are available which could make this possible if there are any.
There are 2 ways you can do that:
Download the log file using instructions here: http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_LogAccess.html#USER_LogAccess.Procedural.Downloading and then upload it to S3
Automate the process of downloading the log file using CLI (check the above link for CLI commands) and upload to S3.

How to connect microservice to SQS/SNS

I have a java microservice that runs in a Docker container in a Ec2 instance .
It has to get notified when a file is dropped in a S3 bucker. We have a SNS and SQS that is connected to the S3 bucket. How can i connect the microserice to the SNS/SQS ? If there is a better way to get the java microservice get notified when the files is dropped into S3 bucket please let me know ?
The AWS SDK for Java is pretty good.
You can either:
write an HTTP endpoint that SNS can post to (see http://docs.aws.amazon.com/sns/latest/dg/SendMessageToHttp.example.java.html)
or
subscribe to an SQS topic (see https://github.com/aws/aws-sdk-java/blob/master/src/samples/AmazonSimpleQueueService/SimpleQueueServiceSample.java).
Yes, this is one use case of AWS Lambda:
As an event-driven compute service where AWS Lambda runs your code in
response to events, such as changes to data in an Amazon S3 bucket or
an Amazon DynamoDB table.
http://docs.aws.amazon.com/lambda/latest/dg/welcome.html
Since it runs your code, you are free to write something that places a request to a microservice.

How to access file storage from web application on Amazon EC2

I am in process of hosting a dynamic website on Amazon EC2. I have created the environment and deployed war on ElasticStalkBean. I can connect to mysql database too. But I am not sure how my web application will read/write to the disk and at which path?
As per my understanding, Amazon provides 3 options for file storage
S3
EBS (Persistant)
instance storage
I could upload files on s3 creaing bucket but how can my web application read or write to S3 bucket path on differnt server?
I am not sure how should i upload files or write file to EBS. Connecting to EC2, I cannot cd /dev/sd* directory for my EBS attached to my environment instance. How can I configure my web app to use this as directory for images etc
Instance storage is lost if I stop or recreate env. and is non persistant. So not interested to store files here.
Can you help me on this?
Where to upload file that are read by application?
Where can my application write files?
Your question: "how can my web application read or write to S3 bucket path on different server?
I'm a newbie user of AWS too, so can only offer limited help, but this is what I understand:
The webapp running in the EC2 instance can access the S3 storage using with the REST or SOAP APIs. Here's the link to the reference guide for using the REST GET function to get a file from S3:
GET object documentation
I guess the idea is that the S3 storage bucket that Amazon create for your EBS "environments" provides permanent storage for your application and data files (images etc.). When a EC2 instance is created or rebooted, it should get any additional application files from an S3 bucket and 'cache' them on the file system ("volume") attached to the EC2 "instance".

Resources