Connecting IDE with AWS-Bucket
Now, using the access keys we obtained earlier, we will connect our IDE with the cloud. To do this, head over to the application.properties file in the resources folder of the spring project that you just created and imported in your IDE. Next, add the following four properties:
- cloud.aws.credentials.access-key={paste-your-access-key-here}
- cloud.aws.credentials.secret-key={paste-your-secret-key-here}
- cloud.aws.region.static={the-region-of-cloud eg: ap-south-1}
- aws.s3.bucket.name={the-name-of-the-bucket-whose-contents-you-want-to-list}
This will allow your ide to interact and fetch resources from your cloud account. Remember to remove your secret keys and access keys, incase you want to share your code.
How To List All AWS S3 Objects In A Bucket Using Java
Amazon Web Services provides its Simple Storage service for uploading data to the cloud. Data in S3 is stored as objects inside buckets. This data can then be used as per the bucket policy. Accessing data through code is one means of processing this stored data in the cloud. In the following sections of this article, we will look at how we can see what objects we have inside our AWS bucket using the AWS Java SDK.