ARTIFACTORY: How should I switch to use the Amazon S3 Official SDK?
Starting from Artifactory 6.12.0 , Artifactory provides comprehensive support for the S3 Cloud storage provider using the official Amazon SDK.
The JetS3t library, previously used in JFrog Artifactory, has now been officially deprecated . Additionally, starting from JFrog Artifactroy 7.46.3 if the configuration of the old template is implemented, Artifactory will fail to start up and generate the following error:
Application could not be initialized: Fail to build binary provider config. Reason couldn't find chain with id: s3, has being deprecated. please refer to JFrog documentation
How to check which S3 SDK I'm using?
To determine the S3 SDK being used, refer to the following filestore configurations:
- For Artifactory 7.x: $JFROG_HOME/artifactory/var/etc/artifactory/binarystore.xml.
- For Artifactory 6.x: $JFROG_HOME/artifactory/etc/binarystore.xml
If the configuration includes a provider with the attribute type="s3-storage-v3", it signifies that the Official Amazon S3 SDK is being utilized. Conversely, if the type is "s3", Artifactory continues to employ the JetS3t library.
In the binarystore.xml file, we should update as below:
| If Exists | Replace to |
|---|---|
| chain template="s3" | chain template="s3-storage-v3" |
| chain template="cluster-s3" | chain template="cluster-s3-storage-v3" |
| provider id="s3" type="s3" | provider id="s3-storage-v3" type="s3-storage-v3" |
| useInstanceCredentials |
| property name="s3service.server-side-encryption" value="AES256" | server-side-encryption-aws-kms |
| property name="s3service.disable-dns-buckets" value="true" | enablePathStyleAccess |
| property name="httpclient.max-connections" value="[NUMBER OF CONNECTIONS]" | maxConnections |
| httpsOnly | useHttp |
After updating the file, a restart of Artifactory will kick-in these changes, and it will switch to use the Amazon official SDK.
Note!
If you have utilized any specific JetS3t properties within the "s3" provider, please be aware that these properties will not be recognized by the new SDK. We recommend referring to our documentation to learn about the necessary modifications that need to be made.
Encryption Method
In contrast to JetS3t, the new SDK provides support for SSE-KMS encryption from the AWS side instead of AES256 encryption used in JetS3t. SSE-256 (Server-Side Encryption with AWS Key Management Service) and SSE-KMS (Server-Side Encryption with AWS Key Management Service) are both encryption options offered by Amazon Web Services (AWS) to secure data at rest in AWS services.
SSE-256 utilizes the AES-256 encryption algorithm to encrypt data at rest, and AWS manages this encryption. On the other hand, SSE-KMS also uses AES-256 encryption but gives you more control over the encryption keys. It leverages AWS Key Management Service (KMS) to manage the encryption keys.
In the context of server-side encryption in AWS, AWS takes responsibility for encrypting the data during upload and decrypting it during download. AWS also maintains metadata on the object to determine the encryption method used. As a result, Artifactory remains independent of the specific encryption method employed since the encryption and decryption processes occur on the AWS S3 side of the transaction.
It's worth noting the significance of the <server-side-encryption-aws-kms> configuration flag. When this flag is set to true, a metadata field is added to the uploaded object, instructing S3 to encrypt it using the default AWS-managed KMS key for S3. Alternatively, you can specify the encryption key ID or alias instead of using "true".
Even though this configuration requires SSE-KMS encryption, you can still upload and download objects using this configuration with the SSE-KMS encryption scheme and retrieve objects that were encrypted using SSE-S3 (AES256).
To illustrate, if you enable KMS encryption for your bucket, you can use the following definition within the bucket:
If you are uncertain about the encryption method you have employed, you can execute the following command:
aws s3api get-bucket-encryption --bucket <bucket name>
The anticipated output for KMS encryption will be:
{
"ServerSideEncryptionConfiguration": {
"Rules": [
{
"ApplyServerSideEncryptionByDefault": {
"SSEAlgorithm": "aws:kms",
"KMSMasterKeyID": "arn:aws:kms:XXXXXX"
},
"BucketKeyEnabled": true
}
]
}
}
(END)
When KMS encryption is utilized, the MD5 checksum in Artifactory side will be encrypted on the AWS side, resulting in a different Etag on the bucket side.
If you do not use this encryption, the MD5 checksum will be identical to the Etag. Please note that Artifactory remains unaffected by these changes, and the transition from AES256 to KMS encryption is seamless. Enabling the KMS flag on the Artifactory side without configuring the KMS on the bucket side will not have any impact either.
ExamplesMigrated Configuration #1 - simple "s3"
<config version="2">
<chain template="s3-storage-v3"/>
<provider id="s3-storage-v3" type="s3-storage-v3">
<endpoint>http://s3.amazonaws.com</endpoint>
<identity>[ENTER IDENTITY HERE]</identity>
<credential>[ENTER CREDENTIALS HERE]</credential>
<path>[ENTER PATH HERE]</path>
<bucketName>[ENTER BUCKET NAME HERE]</bucketName>
</provider>
</config>Old Configuration #2 - "s3" with properties
<config version="v1">
<chain>
<provider id="cache-fs" type="cache-fs">
<provider id="eventual" type="eventual">
<provider id="retry" type="retry">
<provider id="s3" type="s3"/>
</provider>
</provider>
</provider>
</chain>
<provider id="cache-fs" type="cache-fs">
<maxCacheSize>100000000000</maxCacheSize>
</provider>
<provider id="eventual" type="eventual">
<numberOfThreads>10</numberOfThreads>
<timeout>180000</timeout>
<dispatcherInterval>5000</dispatcherInterval>
</provider>
<provider id="retry" type="retry">
<maxTrys>10</maxTrys>
<interval>1000</interval>
</provider>
<provider id="s3" type="s3">
<endpoint>http://s3.amazonaws.com</endpoint>
<refreshCredentials>true</refreshCredentials>
<roleName>[ENTER IAM Role NAME HERE]</roleName>
<path>[ENTER PATH HERE]</path>
<bucketName>[ENTER BUCKET NAME HERE]</bucketName>
<property name="s3service.server-side-encryption" value="AES256"></property>
<property name="s3service.disable-dns-buckets" value="true"></property>
<property name="httpclient.max-connections" value="200"></property>
</provider>
</config>
Migrated Configuration #2 - "s3" with properties
<config version="v1">
<chain>
<provider id="cache-fs" type="cache-fs">
<provider id="eventual" type="eventual">
<provider id="retry" type="retry">
<provider id="s3-storage-v3" type="s3-storage-v3"/>
</provider>
</provider>
</provider>
</chain>
<provider id="cache-fs" type="cache-fs">
<maxCacheSize>100000000000</maxCacheSize>
</provider>
<provider id="eventual" type="eventual">
<numberOfThreads>10</numberOfThreads>
<timeout>180000</timeout>
<dispatcherInterval>5000</dispatcherInterval>
</provider>
<provider id="retry" type="retry">
<maxTrys>10</maxTrys>
<interval>1000</interval>
</provider>
<provider id="s3-storage-v3" type="s3-storage-v3">
<endpoint>http://s3.amazonaws.com</endpoint>
<useInstanceCredentials>true</useInstanceCredentials>
<path>[ENTER PATH HERE]</path>
<bucketName>[ENTER BUCKET NAME HERE]</bucketName>
<server-side-encryption-aws-kms>true</server-side-encryption-aws-kms>
<enablePathStyleAccess>true</enablePathStyleAccess>
<maxConnections>200</maxConnections>
</provider>
</config>
Old Configuration #3 - "cluster-s3"
<config version="2">
<chain>
<provider id="cache-fs-eventual-s3" type="cache-fs">
<provider id="sharding-cluster-eventual-s3" type="sharding-cluster">
<sub-provider id="eventual-cluster-s3" type="eventual-cluster">
<provider id="retry-s3" type="retry">
<provider id="s3" type="s3"/>
</provider>
</sub-provider>
<dynamic-provider id="remote-s3" type="remote"/>
</provider>
</provider>
</chain>
<provider id="cache-fs-eventual-s3" type="cache-fs">
<maxCacheSize>100000000000</maxCacheSize>
</provider>
<provider id="sharding-cluster-eventual-s3" type="sharding-cluster">
<redundancy>3</redundancy>
<lenientLimit>2</lenientLimit>
<property name="zones" value="local,remote"/>
</provider>
<provider id="eventual-cluster-s3" type="eventual-cluster">
<maxWorkers>10</maxWorkers>
<dispatcherInterval>1000</dispatcherInterval>
<checkPeriod>15000</checkPeriod>
<addStalePeriod>300000</addStalePeriod>
<zone>local</zone>
</provider>
<provider id="remote-s3" type="remote">
<checkPeriod>15000</checkPeriod>
<connectionTimeout>5000</connectionTimeout>
<socketTimeout>15000</socketTimeout>
<maxConnections>200</maxConnections>
<connectionRetry>2</connectionRetry>
<zone>remote</zone>
</provider>
<provider id="s3" type="s3">
<endpoint>http://s3.amazonaws.com</endpoint>
<identity>[ENTER IDENTITY HERE]</identity>
<credential>[ENTER CREDENTIALS HERE]</credential>
<path>[ENTER PATH HERE]</path>
<bucketName>[ENTER BUCKET NAME HERE]</bucketName>
</provider>
</config>
Migrated Configuration #3 - "cluster-s3"
<config version="2">
<chain>
<provider id="cache-fs-eventual-s3" type="cache-fs">
<provider id="sharding-cluster-eventual-s3" type="sharding-cluster">
<sub-provider id="eventual-cluster-s3" type="eventual-cluster">
<provider id="retry-s3" type="retry">
<provider id="s3-storage-v3" type="s3-storage-v3"/>
</provider>
</sub-provider>
<dynamic-provider id="remote-s3" type="remote"/>
</provider>
</provider>
</chain>
<provider id="cache-fs-eventual-s3" type="cache-fs">
<maxCacheSize>100000000000</maxCacheSize>
</provider>
<provider id="sharding-cluster-eventual-s3" type="sharding-cluster">
<redundancy>3</redundancy>
<lenientLimit>2</lenientLimit>
<property name="zones" value="local,remote"/>
</provider>
<provider id="eventual-cluster-s3" type="eventual-cluster">
<maxWorkers>10</maxWorkers>
<dispatcherInterval>1000</dispatcherInterval>
<checkPeriod>15000</checkPeriod>
<addStalePeriod>300000</addStalePeriod>
<zone>local</zone>
</provider>
<provider id="remote-s3" type="remote">
<checkPeriod>15000</checkPeriod>
<connectionTimeout>5000</connectionTimeout>
<socketTimeout>15000</socketTimeout>
<maxConnections>200</maxConnections>
<connectionRetry>2</connectionRetry>
<zone>remote</zone>
</provider>
<provider id="s3-storage-v3" type="s3-storage-v3">
<endpoint>http://s3.amazonaws.com</endpoint>
<identity>[ENTER IDENTITY HERE]</identity>
<credential>[ENTER CREDENTIALS HERE]</credential>
<path>[ENTER PATH HERE]</path>
<bucketName>[ENTER BUCKET NAME HERE]</bucketName>
</provider>
</config>