You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2026/07/17 18:49:20 UTC

(camel) branch main updated: CAMEL-24157: camel-aws2 - Fix medium-severity findings from July 2026 review (#24864)

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 4f887ea6d264 CAMEL-24157: camel-aws2 - Fix medium-severity findings from July 2026 review (#24864)
4f887ea6d264 is described below

commit 4f887ea6d2648d412c2cb0bb5b87fb6d2582f2d8
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Jul 17 20:49:13 2026 +0200

    CAMEL-24157: camel-aws2 - Fix medium-severity findings from July 2026 review (#24864)
    
    CAMEL-24157: camel-aws2 - Fix medium-severity findings from July 2026 review
    
    Co-Authored-By: Claude Opus 4.6 <no...@anthropic.com>
---
 .../apache/camel/catalog/components/aws2-s3.json   |  2 +-
 .../camel/component/aws2/ddb/Ddb2Endpoint.java     |  6 +--
 .../camel/component/aws2/ddb/ScanCommand.java      |  3 +-
 .../ddb/transform/Ddb2JsonDataTypeTransformer.java |  4 +-
 .../apache/camel/component/aws2/s3/aws2-s3.json    |  2 +-
 .../camel/component/aws2/s3/AWS2S3Consumer.java    | 38 +++++++++++++----
 .../camel/component/aws2/s3/AWS2S3Endpoint.java    | 13 +++++-
 .../camel/component/aws2/s3/AWS2S3Producer.java    | 47 +++++++++++++++++++---
 .../camel/component/aws2/sns/Sns2Endpoint.java     |  9 +++--
 .../aws2/sns/Sns2ProducerHealthCheck.java          | 10 ++++-
 .../camel/component/aws2/sqs/Sqs2Producer.java     | 12 ++++--
 .../endpoint/dsl/AWS2S3EndpointBuilderFactory.java | 12 +++++-
 12 files changed, 124 insertions(+), 34 deletions(-)

diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-s3.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-s3.json
index 37c3be71c490..6d0923131e2f 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-s3.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-s3.json
@@ -164,7 +164,7 @@
     "fileName": { "index": 19, "kind": "parameter", "displayName": "File Name", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": "configuration", "description": "To get the object from the bucket with the given file name" },
     "includeBody": { "index": 20, "kind": "parameter", "displayName": "Include Body", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": "configuration", "description": "If it is true, the S3Object exchange will be consumed and put into the body and closed.  [...]
     "includeFolders": { "index": 21, "kind": "parameter", "displayName": "Include Folders", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": "configuration", "description": "If it is true, the folders\/directories will be consumed. If it is false, they wil [...]
-    "maxConnections": { "index": 22, "kind": "parameter", "displayName": "Max Connections", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 60, "description": "Set the maxConnections parameter in the S3 client configuration" },
+    "maxConnections": { "index": 22, "kind": "parameter", "displayName": "Max Connections", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": true, "autowired": false, "secret": false, "defaultValue": 60, "description": "Set the maxConnections parameter in the S3 client configuration. This option is deprecated and has no effect. Use the httpClientBuilder option on the S3 client configuration to customize the HTTP client conne [...]
     "maxMessagesPerPoll": { "index": 23, "kind": "parameter", "displayName": "Max Messages Per Poll", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 10, "description": "Gets the maximum number of messages as a limit to poll at each polling. Gets the maximum number of messages as a limit to poll at each polling. The default value is 10. Use 0 or a negative number t [...]
     "moveAfterRead": { "index": 24, "kind": "parameter", "displayName": "Move After Read", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": "configuration", "description": "Move objects from S3 bucket to a different bucket after they have been retrieved.  [...]
     "removePrefixOnMove": { "index": 25, "kind": "parameter", "displayName": "Remove Prefix On Move", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": "configuration", "description": "Remove the contents of the prefix configuration string from the new S3O [...]
diff --git a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Endpoint.java b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Endpoint.java
index 33451093f7d5..ace1cb5f07ed 100644
--- a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Endpoint.java
+++ b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Endpoint.java
@@ -171,10 +171,10 @@ public class Ddb2Endpoint extends ScheduledPollEndpoint implements EndpointServi
                 return true;
             }
             LOG.trace("Table [{}] not active yet", tableName);
+        } catch (ResourceNotFoundException e) {
+            // table may not be visible yet due to eventual consistency
         } catch (AwsServiceException ase) {
-            if (!ase.getMessage().contains("ResourceNotFoundException")) {
-                throw ase;
-            }
+            throw ase;
         }
         return false;
     }
diff --git a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/ScanCommand.java b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/ScanCommand.java
index 255a97d9a988..db9fa1b14652 100644
--- a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/ScanCommand.java
+++ b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/ScanCommand.java
@@ -39,7 +39,8 @@ public class ScanCommand extends AbstractDdbCommand {
                 .limit(determineLimit())
                 .exclusiveStartKey(determineExclusiveStartKey())
                 .attributesToGet(determineAttributeNames())
-                .scanFilter(determineScanFilter());
+                .scanFilter(determineScanFilter())
+                .consistentRead(determineConsistentRead());
 
         // Check if we have set an Index Name
         String indexName = determineIndexName();
diff --git a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/transform/Ddb2JsonDataTypeTransformer.java b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/transform/Ddb2JsonDataTypeTransformer.java
index 123c85a03066..80f2e2aac2ee 100644
--- a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/transform/Ddb2JsonDataTypeTransformer.java
+++ b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/transform/Ddb2JsonDataTypeTransformer.java
@@ -219,8 +219,8 @@ public class Ddb2JsonDataTypeTransformer extends Transformer {
             List<?> values = (List<?>) value;
 
             if (values.isEmpty()) {
-                return AttributeValue.builder().ss().build();
-            } else if (values.get(0) instanceof Integer) {
+                return AttributeValue.builder().l(List.of()).build();
+            } else if (values.get(0) instanceof Number) {
                 return AttributeValue.builder().ns(values.stream().map(Object::toString).collect(Collectors.toList())).build();
             } else {
                 return AttributeValue.builder().ss(values.stream().map(Object::toString).collect(Collectors.toList())).build();
diff --git a/components/camel-aws/camel-aws2-s3/src/generated/resources/META-INF/org/apache/camel/component/aws2/s3/aws2-s3.json b/components/camel-aws/camel-aws2-s3/src/generated/resources/META-INF/org/apache/camel/component/aws2/s3/aws2-s3.json
index 37c3be71c490..6d0923131e2f 100644
--- a/components/camel-aws/camel-aws2-s3/src/generated/resources/META-INF/org/apache/camel/component/aws2/s3/aws2-s3.json
+++ b/components/camel-aws/camel-aws2-s3/src/generated/resources/META-INF/org/apache/camel/component/aws2/s3/aws2-s3.json
@@ -164,7 +164,7 @@
     "fileName": { "index": 19, "kind": "parameter", "displayName": "File Name", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": "configuration", "description": "To get the object from the bucket with the given file name" },
     "includeBody": { "index": 20, "kind": "parameter", "displayName": "Include Body", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": "configuration", "description": "If it is true, the S3Object exchange will be consumed and put into the body and closed.  [...]
     "includeFolders": { "index": 21, "kind": "parameter", "displayName": "Include Folders", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": "configuration", "description": "If it is true, the folders\/directories will be consumed. If it is false, they wil [...]
-    "maxConnections": { "index": 22, "kind": "parameter", "displayName": "Max Connections", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 60, "description": "Set the maxConnections parameter in the S3 client configuration" },
+    "maxConnections": { "index": 22, "kind": "parameter", "displayName": "Max Connections", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": true, "autowired": false, "secret": false, "defaultValue": 60, "description": "Set the maxConnections parameter in the S3 client configuration. This option is deprecated and has no effect. Use the httpClientBuilder option on the S3 client configuration to customize the HTTP client conne [...]
     "maxMessagesPerPoll": { "index": 23, "kind": "parameter", "displayName": "Max Messages Per Poll", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 10, "description": "Gets the maximum number of messages as a limit to poll at each polling. Gets the maximum number of messages as a limit to poll at each polling. The default value is 10. Use 0 or a negative number t [...]
     "moveAfterRead": { "index": 24, "kind": "parameter", "displayName": "Move After Read", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": "configuration", "description": "Move objects from S3 bucket to a different bucket after they have been retrieved.  [...]
     "removePrefixOnMove": { "index": 25, "kind": "parameter", "displayName": "Remove Prefix On Move", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": "configuration", "description": "Remove the contents of the prefix configuration string from the new S3O [...]
diff --git a/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Consumer.java b/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Consumer.java
index eebd38a2777b..a0e5fce60195 100644
--- a/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Consumer.java
+++ b/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Consumer.java
@@ -68,6 +68,7 @@ public class AWS2S3Consumer extends ScheduledBatchPollingConsumer {
     private static final Logger LOG = LoggerFactory.getLogger(AWS2S3Consumer.class);
 
     private String marker;
+    private boolean markerIsContinuationToken = true;
     private transient String s3ConsumerToString;
 
     public AWS2S3Consumer(AWS2S3Endpoint endpoint, Processor processor) {
@@ -125,8 +126,20 @@ public class AWS2S3Consumer extends ScheduledBatchPollingConsumer {
         } else if (fileName != null) {
             LOG.trace("Getting object in bucket [{}] with file name [{}]...", bucketName, fileName);
 
+            GetObjectRequest.Builder getRequest = GetObjectRequest.builder().bucket(bucketName).key(fileName);
+            if (getConfiguration().isUseCustomerKey()) {
+                if (ObjectHelper.isNotEmpty(getConfiguration().getCustomerKeyId())) {
+                    getRequest.sseCustomerKey(getConfiguration().getCustomerKeyId());
+                }
+                if (ObjectHelper.isNotEmpty(getConfiguration().getCustomerKeyMD5())) {
+                    getRequest.sseCustomerKeyMD5(getConfiguration().getCustomerKeyMD5());
+                }
+                if (ObjectHelper.isNotEmpty(getConfiguration().getCustomerAlgorithm())) {
+                    getRequest.sseCustomerAlgorithm(getConfiguration().getCustomerAlgorithm());
+                }
+            }
             ResponseInputStream<GetObjectResponse> s3Object
-                    = getAmazonS3Client().getObject(GetObjectRequest.builder().bucket(bucketName).key(fileName).build());
+                    = getAmazonS3Client().getObject(getRequest.build());
             exchanges = createExchanges(s3Object, fileName);
         } else {
             LOG.trace("Queueing objects in bucket [{}]...", bucketName);
@@ -147,26 +160,35 @@ public class AWS2S3Consumer extends ScheduledBatchPollingConsumer {
             // continue from where we left last time
             if (marker != null) {
                 LOG.trace("Resuming from marker: {}", marker);
-                listObjectsRequest.continuationToken(marker);
+                if (markerIsContinuationToken) {
+                    listObjectsRequest.continuationToken(marker);
+                } else {
+                    listObjectsRequest.startAfter(marker);
+                }
             }
 
             ListObjectsV2Response listObjects = getAmazonS3Client().listObjectsV2(listObjectsRequest.build());
 
             if (Boolean.TRUE.equals(listObjects.isTruncated())) {
                 String next = listObjects.nextContinuationToken();
-                if (next == null && listObjects.hasContents() && ObjectHelper.isEmpty(listObjects.prefix())) {
-                    // fallback to use last key from the returned list of objects
+                if (next != null) {
+                    markerIsContinuationToken = true;
+                } else if (listObjects.hasContents()) {
+                    // S3-compatible stores may omit nextContinuationToken;
+                    // fall back to startAfter with the last returned key
                     int size = listObjects.contents().size();
                     if (size > 0) {
                         S3Object last = listObjects.contents().get(size - 1);
                         next = last.key();
                     }
+                    markerIsContinuationToken = false;
                 }
                 marker = next;
-                LOG.trace("Returned list is truncated, so setting next continuation token: {}", marker);
+                LOG.trace("Returned list is truncated, so setting next marker: {}", marker);
             } else {
                 // no more data so clear marker
                 marker = null;
+                markerIsContinuationToken = true;
             }
             if (LOG.isTraceEnabled()) {
                 LOG.trace("Found {} objects in bucket [{}]...", listObjects.contents().size(), bucketName);
@@ -364,8 +386,10 @@ public class AWS2S3Consumer extends ScheduledBatchPollingConsumer {
                 builder.append(AWS2S3Utils.evaluateDestinationBucketSuffix(exchange, getConfiguration()));
 
                 String destinationKey = builder.toString();
-                if (getConfiguration().isRemovePrefixOnMove()) {
-                    destinationKey = destinationKey.replaceFirst(getConfiguration().getPrefix(), "");
+                if (getConfiguration().isRemovePrefixOnMove()
+                        && ObjectHelper.isNotEmpty(getConfiguration().getPrefix())
+                        && destinationKey.startsWith(getConfiguration().getPrefix())) {
+                    destinationKey = destinationKey.substring(getConfiguration().getPrefix().length());
                 }
 
                 getAmazonS3Client().copyObject(CopyObjectRequest.builder().destinationKey(destinationKey)
diff --git a/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Endpoint.java b/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Endpoint.java
index e2db0faba804..7350a7bebd8f 100644
--- a/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Endpoint.java
+++ b/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Endpoint.java
@@ -63,7 +63,11 @@ public class AWS2S3Endpoint extends ScheduledPollEndpoint implements EndpointSer
     private AWS2S3Configuration configuration;
     @UriParam(label = "consumer", defaultValue = "10")
     private int maxMessagesPerPoll = 10;
-    @UriParam(label = "consumer", defaultValue = "60")
+    @Deprecated
+    @UriParam(label = "consumer", defaultValue = "60",
+              description = "Set the maxConnections parameter in the S3 client configuration. This option is"
+                            + " deprecated and has no effect. Use the httpClientBuilder option on the S3 client"
+                            + " configuration to customize the HTTP client connection pool.")
     private int maxConnections = 50 + maxMessagesPerPoll;
     @UriParam(label = "consumer,advanced", description = "A pluggable in-progress repository "
                                                          + "org.apache.camel.spi.IdempotentRepository. The in-progress repository is used to account the current in "
@@ -229,13 +233,18 @@ public class AWS2S3Endpoint extends ScheduledPollEndpoint implements EndpointSer
         this.maxMessagesPerPoll = maxMessagesPerPoll;
     }
 
+    /**
+     * @deprecated This option has no effect and will be removed in a future release.
+     */
+    @Deprecated
     public int getMaxConnections() {
         return maxConnections;
     }
 
     /**
-     * Set the maxConnections parameter in the S3 client configuration
+     * @deprecated This option has no effect and will be removed in a future release.
      */
+    @Deprecated
     public void setMaxConnections(int maxConnections) {
         this.maxConnections = maxConnections;
     }
diff --git a/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java b/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java
index 728cc5d946ef..eecb6949cf74 100644
--- a/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java
+++ b/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java
@@ -42,7 +42,9 @@ import org.apache.camel.util.ObjectHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
+import software.amazon.awssdk.auth.credentials.AwsSessionCredentials;
 import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider;
+import software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider;
 import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
 import software.amazon.awssdk.awscore.AwsResponse;
 import software.amazon.awssdk.core.ResponseInputStream;
@@ -642,6 +644,17 @@ public class AWS2S3Producer extends DefaultProducer {
             if (ObjectHelper.isNotEmpty(ifUnmodifiedSince)) {
                 req.ifUnmodifiedSince(ifUnmodifiedSince);
             }
+            if (getConfiguration().isUseCustomerKey()) {
+                if (ObjectHelper.isNotEmpty(getConfiguration().getCustomerKeyId())) {
+                    req.sseCustomerKey(getConfiguration().getCustomerKeyId());
+                }
+                if (ObjectHelper.isNotEmpty(getConfiguration().getCustomerKeyMD5())) {
+                    req.sseCustomerKeyMD5(getConfiguration().getCustomerKeyMD5());
+                }
+                if (ObjectHelper.isNotEmpty(getConfiguration().getCustomerAlgorithm())) {
+                    req.sseCustomerAlgorithm(getConfiguration().getCustomerAlgorithm());
+                }
+            }
             ResponseInputStream<GetObjectResponse> res = s3Client.getObject(req.build(), ResponseTransformer.toInputStream());
 
             Message message = getMessageForResponse(exchange);
@@ -677,6 +690,17 @@ public class AWS2S3Producer extends DefaultProducer {
 
             GetObjectRequest.Builder req = GetObjectRequest.builder().bucket(bucketName).key(keyName)
                     .range("bytes=" + Long.parseLong(rangeStart) + "-" + Long.parseLong(rangeEnd));
+            if (getConfiguration().isUseCustomerKey()) {
+                if (ObjectHelper.isNotEmpty(getConfiguration().getCustomerKeyId())) {
+                    req.sseCustomerKey(getConfiguration().getCustomerKeyId());
+                }
+                if (ObjectHelper.isNotEmpty(getConfiguration().getCustomerKeyMD5())) {
+                    req.sseCustomerKeyMD5(getConfiguration().getCustomerKeyMD5());
+                }
+                if (ObjectHelper.isNotEmpty(getConfiguration().getCustomerAlgorithm())) {
+                    req.sseCustomerAlgorithm(getConfiguration().getCustomerAlgorithm());
+                }
+            }
             ResponseInputStream<GetObjectResponse> res = s3Client.getObject(req.build(), ResponseTransformer.toInputStream());
 
             Message message = getMessageForResponse(exchange);
@@ -1089,12 +1113,23 @@ public class AWS2S3Producer extends DefaultProducer {
         }
 
         S3Presigner.Builder builder = S3Presigner.builder();
-        builder.credentialsProvider(
-                getConfiguration().isUseDefaultCredentialsProvider()
-                        ? DefaultCredentialsProvider.create() : StaticCredentialsProvider.create(
-                                AwsBasicCredentials.create(getConfiguration().getAccessKey(),
-                                        getConfiguration().getSecretKey())))
-                .region(Region.of(getConfiguration().getRegion()));
+        if (getConfiguration().isUseDefaultCredentialsProvider()) {
+            builder.credentialsProvider(DefaultCredentialsProvider.create());
+        } else if (getConfiguration().isUseProfileCredentialsProvider()) {
+            builder.credentialsProvider(
+                    ProfileCredentialsProvider.create(getConfiguration().getProfileCredentialsName()));
+        } else if (getConfiguration().isUseSessionCredentials()) {
+            builder.credentialsProvider(StaticCredentialsProvider.create(
+                    AwsSessionCredentials.create(getConfiguration().getAccessKey(),
+                            getConfiguration().getSecretKey(), getConfiguration().getSessionToken())));
+        } else {
+            builder.credentialsProvider(StaticCredentialsProvider.create(
+                    AwsBasicCredentials.create(getConfiguration().getAccessKey(),
+                            getConfiguration().getSecretKey())));
+        }
+        if (ObjectHelper.isNotEmpty(getConfiguration().getRegion())) {
+            builder.region(Region.of(getConfiguration().getRegion()));
+        }
 
         if (getConfiguration().isForcePathStyle()) {
             builder.serviceConfiguration(S3Configuration.builder().pathStyleAccessEnabled(true).build());
diff --git a/components/camel-aws/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Endpoint.java b/components/camel-aws/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Endpoint.java
index 10e13d46e43d..3c64b5fa5c10 100644
--- a/components/camel-aws/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Endpoint.java
+++ b/components/camel-aws/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Endpoint.java
@@ -140,8 +140,11 @@ public class Sns2Endpoint extends DefaultEndpoint implements HeaderFilterStrateg
             if (configuration.isServerSideEncryptionEnabled()) {
                 if (ObjectHelper.isNotEmpty(configuration.getKmsMasterKeyId())) {
                     attributes.put("KmsMasterKeyId", configuration.getKmsMasterKeyId());
-                    builder.attributes(attributes);
+                } else {
+                    throw new IllegalArgumentException(
+                            "The option kmsMasterKeyId is required when serverSideEncryptionEnabled is true");
                 }
+                builder.attributes(attributes);
             }
 
             if (configuration.isFifoTopic()) {
@@ -173,14 +176,14 @@ public class Sns2Endpoint extends DefaultEndpoint implements HeaderFilterStrateg
         }
 
         if (configuration.isSubscribeSNStoSQS()) {
-            if (ObjectHelper.isNotEmpty(ObjectHelper.isNotEmpty(configuration.getQueueArn()))) {
+            if (ObjectHelper.isNotEmpty(configuration.getQueueArn())) {
                 SubscribeResponse resp = snsClient.subscribe(SubscribeRequest.builder().topicArn(configuration.getTopicArn())
                         .protocol("sqs").endpoint(configuration.getQueueArn())
                         .returnSubscriptionArn(true).build());
                 LOG.trace("Subscription of SQS Queue to SNS Topic done with Amazon resource name: {}", resp.subscriptionArn());
             } else {
                 throw new IllegalArgumentException(
-                        "Using the SubscribeSNStoSQS option require both AmazonSQSClient and Queue URL options");
+                        "Using the SubscribeSNStoSQS option requires the queueArn option to be set");
             }
         }
 
diff --git a/components/camel-aws/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2ProducerHealthCheck.java b/components/camel-aws/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2ProducerHealthCheck.java
index dfa21751b5d0..a54abbadd867 100644
--- a/components/camel-aws/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2ProducerHealthCheck.java
+++ b/components/camel-aws/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2ProducerHealthCheck.java
@@ -20,9 +20,11 @@ import java.util.Map;
 
 import org.apache.camel.health.HealthCheckResultBuilder;
 import org.apache.camel.impl.health.AbstractHealthCheck;
+import org.apache.camel.util.ObjectHelper;
 import software.amazon.awssdk.awscore.exception.AwsServiceException;
 import software.amazon.awssdk.regions.Region;
 import software.amazon.awssdk.services.sns.SnsClient;
+import software.amazon.awssdk.services.sns.model.GetTopicAttributesRequest;
 
 public class Sns2ProducerHealthCheck extends AbstractHealthCheck {
 
@@ -37,13 +39,17 @@ public class Sns2ProducerHealthCheck extends AbstractHealthCheck {
     protected void doCall(HealthCheckResultBuilder builder, Map<String, Object> options) {
         Sns2Configuration configuration = sns2Endpoint.getConfiguration();
         try {
-            if (!SnsClient.serviceMetadata().regions().contains(Region.of(configuration.getRegion()))) {
+            if (ObjectHelper.isNotEmpty(configuration.getRegion())
+                    && !SnsClient.serviceMetadata().regions().contains(Region.of(configuration.getRegion()))) {
                 builder.message("The service is not supported in this region");
                 builder.down();
                 return;
             }
             SnsClient client = sns2Endpoint.getSNSClient();
-            client.listSubscriptions();
+            if (ObjectHelper.isNotEmpty(configuration.getTopicArn())) {
+                client.getTopicAttributes(
+                        GetTopicAttributesRequest.builder().topicArn(configuration.getTopicArn()).build());
+            }
         } catch (AwsServiceException e) {
             builder.message(e.getMessage());
             builder.error(e);
diff --git a/components/camel-aws/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/Sqs2Producer.java b/components/camel-aws/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/Sqs2Producer.java
index 0518d36791d7..1295bf948d05 100644
--- a/components/camel-aws/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/Sqs2Producer.java
+++ b/components/camel-aws/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/Sqs2Producer.java
@@ -63,10 +63,6 @@ public class Sqs2Producer extends DefaultProducer {
 
     public Sqs2Producer(Sqs2Endpoint endpoint) {
         super(endpoint);
-        if (endpoint.getConfiguration().isFifoQueue()
-                && ObjectHelper.isEmpty(getEndpoint().getConfiguration().getMessageGroupIdStrategy())) {
-            throw new IllegalArgumentException("messageGroupIdStrategy must be set for FIFO queues.");
-        }
     }
 
     @Override
@@ -98,6 +94,10 @@ public class Sqs2Producer extends DefaultProducer {
     }
 
     public void processSingleMessage(final Exchange exchange) {
+        if (getEndpoint().getConfiguration().isFifoQueue()
+                && ObjectHelper.isEmpty(getEndpoint().getConfiguration().getMessageGroupIdStrategy())) {
+            throw new IllegalArgumentException("messageGroupIdStrategy must be set for FIFO queues.");
+        }
         String body = exchange.getIn().getBody(String.class);
         SendMessageRequest.Builder request = SendMessageRequest.builder().queueUrl(getQueueUrl()).messageBody(body);
         request.messageAttributes(translateAttributes(exchange.getIn().getHeaders(), exchange));
@@ -117,6 +117,10 @@ public class Sqs2Producer extends DefaultProducer {
     }
 
     private void sendBatchMessage(SqsClient amazonSQS, Exchange exchange) {
+        if (getEndpoint().getConfiguration().isFifoQueue()
+                && ObjectHelper.isEmpty(getEndpoint().getConfiguration().getMessageGroupIdStrategy())) {
+            throw new IllegalArgumentException("messageGroupIdStrategy must be set for FIFO queues.");
+        }
         SendMessageBatchRequest.Builder request = SendMessageBatchRequest.builder().queueUrl(getQueueUrl());
         Collection<SendMessageBatchRequestEntry> entries = new ArrayList<>();
         if (exchange.getIn().getBody() instanceof Iterable) {
diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/AWS2S3EndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/AWS2S3EndpointBuilderFactory.java
index 6f7cbfe2f710..dee1c1366d97 100644
--- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/AWS2S3EndpointBuilderFactory.java
+++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/AWS2S3EndpointBuilderFactory.java
@@ -484,7 +484,10 @@ public interface AWS2S3EndpointBuilderFactory {
             return this;
         }
         /**
-         * Set the maxConnections parameter in the S3 client configuration.
+         * Set the maxConnections parameter in the S3 client configuration. This
+         * option is deprecated and has no effect. Use the httpClientBuilder
+         * option on the S3 client configuration to customize the HTTP client
+         * connection pool.
          * 
          * The option is a: <code>int</code> type.
          * 
@@ -494,12 +497,16 @@ public interface AWS2S3EndpointBuilderFactory {
          * @param maxConnections the value to set
          * @return the dsl builder
          */
+        @Deprecated
         default AWS2S3EndpointConsumerBuilder maxConnections(int maxConnections) {
             doSetProperty("maxConnections", maxConnections);
             return this;
         }
         /**
-         * Set the maxConnections parameter in the S3 client configuration.
+         * Set the maxConnections parameter in the S3 client configuration. This
+         * option is deprecated and has no effect. Use the httpClientBuilder
+         * option on the S3 client configuration to customize the HTTP client
+         * connection pool.
          * 
          * The option will be converted to a <code>int</code> type.
          * 
@@ -509,6 +516,7 @@ public interface AWS2S3EndpointBuilderFactory {
          * @param maxConnections the value to set
          * @return the dsl builder
          */
+        @Deprecated
         default AWS2S3EndpointConsumerBuilder maxConnections(String maxConnections) {
             doSetProperty("maxConnections", maxConnections);
             return this;