

# Code examples for Amazon S3 using AWS SDKs
<a name="service_code_examples"></a>

The following code examples show how to use Amazon S3 with an AWS software development kit (SDK). 

For a complete list of AWS SDK developer guides and code examples, see [Developing with Amazon S3 using the AWS SDKs](sdk-general-information-section.md). This topic also includes information about getting started and details about previous SDK versions.

**Contents**
+ [Amazon S3](service_code_examples_s3.md)
  + [Basics](service_code_examples_s3_basics.md)
    + [Hello Amazon S3](s3_example_s3_Hello_section.md)
    + [Learn the basics](s3_example_s3_Scenario_GettingStarted_section.md)
    + [Actions](service_code_examples_s3_actions.md)
      + [`AbortMultipartUpload`](s3_example_s3_AbortMultipartUpload_section.md)
      + [`CompleteMultipartUpload`](s3_example_s3_CompleteMultipartUpload_section.md)
      + [`CopyObject`](s3_example_s3_CopyObject_section.md)
      + [`CreateBucket`](s3_example_s3_CreateBucket_section.md)
      + [`CreateMultiRegionAccessPoint`](s3_example_s3_CreateMultiRegionAccessPoint_section.md)
      + [`CreateMultipartUpload`](s3_example_s3_CreateMultipartUpload_section.md)
      + [`CreatePresignedPost`](s3_example_s3_CreatePresignedPost_section.md)
      + [`DeleteBucket`](s3_example_s3_DeleteBucket_section.md)
      + [`DeleteBucketAnalyticsConfiguration`](s3_example_s3_DeleteBucketAnalyticsConfiguration_section.md)
      + [`DeleteBucketCors`](s3_example_s3_DeleteBucketCors_section.md)
      + [`DeleteBucketEncryption`](s3_example_s3_DeleteBucketEncryption_section.md)
      + [`DeleteBucketInventoryConfiguration`](s3_example_s3_DeleteBucketInventoryConfiguration_section.md)
      + [`DeleteBucketLifecycle`](s3_example_s3_DeleteBucketLifecycle_section.md)
      + [`DeleteBucketMetricsConfiguration`](s3_example_s3_DeleteBucketMetricsConfiguration_section.md)
      + [`DeleteBucketPolicy`](s3_example_s3_DeleteBucketPolicy_section.md)
      + [`DeleteBucketReplication`](s3_example_s3_DeleteBucketReplication_section.md)
      + [`DeleteBucketTagging`](s3_example_s3_DeleteBucketTagging_section.md)
      + [`DeleteBucketWebsite`](s3_example_s3_DeleteBucketWebsite_section.md)
      + [`DeleteObject`](s3_example_s3_DeleteObject_section.md)
      + [`DeleteObjectTagging`](s3_example_s3_DeleteObjectTagging_section.md)
      + [`DeleteObjects`](s3_example_s3_DeleteObjects_section.md)
      + [`DeletePublicAccessBlock`](s3_example_s3_DeletePublicAccessBlock_section.md)
      + [`GetBucketAccelerateConfiguration`](s3_example_s3_GetBucketAccelerateConfiguration_section.md)
      + [`GetBucketAcl`](s3_example_s3_GetBucketAcl_section.md)
      + [`GetBucketAnalyticsConfiguration`](s3_example_s3_GetBucketAnalyticsConfiguration_section.md)
      + [`GetBucketCors`](s3_example_s3_GetBucketCors_section.md)
      + [`GetBucketEncryption`](s3_example_s3_GetBucketEncryption_section.md)
      + [`GetBucketInventoryConfiguration`](s3_example_s3_GetBucketInventoryConfiguration_section.md)
      + [`GetBucketLifecycleConfiguration`](s3_example_s3_GetBucketLifecycleConfiguration_section.md)
      + [`GetBucketLocation`](s3_example_s3_GetBucketLocation_section.md)
      + [`GetBucketLogging`](s3_example_s3_GetBucketLogging_section.md)
      + [`GetBucketMetricsConfiguration`](s3_example_s3_GetBucketMetricsConfiguration_section.md)
      + [`GetBucketNotification`](s3_example_s3_GetBucketNotification_section.md)
      + [`GetBucketPolicy`](s3_example_s3_GetBucketPolicy_section.md)
      + [`GetBucketPolicyStatus`](s3_example_s3_GetBucketPolicyStatus_section.md)
      + [`GetBucketReplication`](s3_example_s3_GetBucketReplication_section.md)
      + [`GetBucketRequestPayment`](s3_example_s3_GetBucketRequestPayment_section.md)
      + [`GetBucketTagging`](s3_example_s3_GetBucketTagging_section.md)
      + [`GetBucketVersioning`](s3_example_s3_GetBucketVersioning_section.md)
      + [`GetBucketWebsite`](s3_example_s3_GetBucketWebsite_section.md)
      + [`GetObject`](s3_example_s3_GetObject_section.md)
      + [`GetObjectAcl`](s3_example_s3_GetObjectAcl_section.md)
      + [`GetObjectAttributes`](s3_example_s3_GetObjectAttributes_section.md)
      + [`GetObjectLegalHold`](s3_example_s3_GetObjectLegalHold_section.md)
      + [`GetObjectLockConfiguration`](s3_example_s3_GetObjectLockConfiguration_section.md)
      + [`GetObjectRetention`](s3_example_s3_GetObjectRetention_section.md)
      + [`GetObjectTagging`](s3_example_s3_GetObjectTagging_section.md)
      + [`GetPublicAccessBlock`](s3_example_s3_GetPublicAccessBlock_section.md)
      + [`HeadBucket`](s3_example_s3_HeadBucket_section.md)
      + [`HeadObject`](s3_example_s3_HeadObject_section.md)
      + [`ListBucketAnalyticsConfigurations`](s3_example_s3_ListBucketAnalyticsConfigurations_section.md)
      + [`ListBucketInventoryConfigurations`](s3_example_s3_ListBucketInventoryConfigurations_section.md)
      + [`ListBuckets`](s3_example_s3_ListBuckets_section.md)
      + [`ListMultipartUploads`](s3_example_s3_ListMultipartUploads_section.md)
      + [`ListObjectVersions`](s3_example_s3_ListObjectVersions_section.md)
      + [`ListObjects`](s3_example_s3_ListObjects_section.md)
      + [`ListObjectsV2`](s3_example_s3_ListObjectsV2_section.md)
      + [`PutBucketAccelerateConfiguration`](s3_example_s3_PutBucketAccelerateConfiguration_section.md)
      + [`PutBucketAcl`](s3_example_s3_PutBucketAcl_section.md)
      + [`PutBucketCors`](s3_example_s3_PutBucketCors_section.md)
      + [`PutBucketEncryption`](s3_example_s3_PutBucketEncryption_section.md)
      + [`PutBucketLifecycleConfiguration`](s3_example_s3_PutBucketLifecycleConfiguration_section.md)
      + [`PutBucketLogging`](s3_example_s3_PutBucketLogging_section.md)
      + [`PutBucketNotification`](s3_example_s3_PutBucketNotification_section.md)
      + [`PutBucketNotificationConfiguration`](s3_example_s3_PutBucketNotificationConfiguration_section.md)
      + [`PutBucketPolicy`](s3_example_s3_PutBucketPolicy_section.md)
      + [`PutBucketReplication`](s3_example_s3_PutBucketReplication_section.md)
      + [`PutBucketRequestPayment`](s3_example_s3_PutBucketRequestPayment_section.md)
      + [`PutBucketTagging`](s3_example_s3_PutBucketTagging_section.md)
      + [`PutBucketVersioning`](s3_example_s3_PutBucketVersioning_section.md)
      + [`PutBucketWebsite`](s3_example_s3_PutBucketWebsite_section.md)
      + [`PutObject`](s3_example_s3_PutObject_section.md)
      + [`PutObjectAcl`](s3_example_s3_PutObjectAcl_section.md)
      + [`PutObjectLegalHold`](s3_example_s3_PutObjectLegalHold_section.md)
      + [`PutObjectLockConfiguration`](s3_example_s3_PutObjectLockConfiguration_section.md)
      + [`PutObjectRetention`](s3_example_s3_PutObjectRetention_section.md)
      + [`RestoreObject`](s3_example_s3_RestoreObject_section.md)
      + [`SelectObjectContent`](s3_example_s3_SelectObjectContent_section.md)
      + [`UploadPart`](s3_example_s3_UploadPart_section.md)
      + [`UploadPartCopy`](s3_example_s3_UploadPartCopy_section.md)
  + [Scenarios](service_code_examples_s3_scenarios.md)
    + [Check if a bucket exists](s3_example_s3_Scenario_DoesBucketExist_section.md)
    + [Convert text to speech and back to text](s3_example_cross_Telephone_section.md)
    + [Create a presigned URL](s3_example_s3_Scenario_PresignedUrl_section.md)
    + [Create a serverless application to manage photos](s3_example_cross_PAM_section.md)
    + [Create a web page that lists Amazon S3 objects](s3_example_s3_Scenario_ListObjectsWeb_section.md)
    + [Create an Amazon Textract explorer application](s3_example_cross_TextractExplorer_section.md)
    + [Delete all objects in a bucket](s3_example_s3_Scenario_DeleteAllObjects_section.md)
    + [Delete incomplete multipart uploads](s3_example_s3_Scenario_AbortMultipartUpload_section.md)
    + [Detect PPE in images](s3_example_cross_RekognitionPhotoAnalyzerPPE_section.md)
    + [Detect entities in text extracted from an image](s3_example_cross_TextractComprehendDetectEntities_section.md)
    + [Detect faces in an image](s3_example_cross_DetectFaces_section.md)
    + [Detect objects in images](s3_example_cross_RekognitionPhotoAnalyzer_section.md)
    + [Detect people and objects in a video](s3_example_cross_RekognitionVideoDetection_section.md)
    + [Download S3 'directories'](s3_example_s3_Scenario_DownloadS3Directory_section.md)
    + [Download objects to a local directory](s3_example_s3_DownloadBucketToDirectory_section.md)
    + [Download stream of unknown size](s3_example_s3_Scenario_DownloadStream_section.md)
    + [Get an object from a Multi-Region Access Point](s3_example_s3_GetObject_MRAP_section.md)
    + [Get an object from a bucket if it has been modified](s3_example_s3_GetObject_IfModifiedSince_section.md)
    + [Get started with encryption](s3_example_s3_Encryption_section.md)
    + [Get started with tags](s3_example_s3_Scenario_Tagging_section.md)
    + [Getting started with Amazon Athena](s3_example_athena_GettingStarted_061_section.md)
    + [Getting started with Amazon EMR](s3_example_emr_GettingStarted_037_section.md)
    + [Getting started with Amazon S3](s3_example_s3_GettingStarted_section.md)
    + [Getting started with Amazon SageMaker Feature Store](s3_example_iam_GettingStarted_028_section.md)
    + [Getting started with Amazon Textract](s3_example_s3_GettingStarted_074_section.md)
    + [Getting started with Config](s3_example_config_service_GettingStarted_053_section.md)
    + [Lock Amazon S3 objects](s3_example_s3_Scenario_ObjectLock_section.md)
    + [Make conditional requests](s3_example_s3_Scenario_ConditionalRequests_section.md)
    + [Manage access control lists (ACLs)](s3_example_s3_Scenario_ManageACLs_section.md)
    + [Manage large messages using S3](s3_example_sqs_Scenario_SqsExtendedClient_section.md)
    + [Manage versioned objects in batches with a Lambda function](s3_example_s3_Scenario_BatchObjectVersioning_section.md)
    + [Parse URIs](s3_example_s3_Scenario_URIParsing_section.md)
    + [Perform a multipart copy](s3_example_s3_MultipartCopy_section.md)
    + [Process S3 event notifications](s3_example_s3_Scenario_ProcessS3EventNotification_section.md)
    + [Save EXIF and other image information](s3_example_cross_DetectLabels_section.md)
    + [Send event notifications to EventBridge](s3_example_s3_Scenario_PutBucketNotificationConfiguration_section.md)
    + [Track uploads and downloads](s3_example_s3_Scenario_TrackUploadDownload_section.md)
    + [Transform data with S3 Object Lambda](s3_example_cross_ServerlessS3DataTransformation_section.md)
    + [Unit and integration test with an SDK](s3_example_cross_Testing_section.md)
    + [Upload directory to a bucket](s3_example_s3_UploadDirectoryToBucket_section.md)
    + [Upload or download large files](s3_example_s3_Scenario_UsingLargeFiles_section.md)
    + [Upload stream of unknown size](s3_example_s3_Scenario_UploadStream_section.md)
    + [Use checksums](s3_example_s3_Scenario_UseChecksums_section.md)
    + [Work with Amazon S3 object integrity](s3_example_s3_Scenario_ObjectIntegrity_section.md)
    + [Work with versioned objects](s3_example_s3_Scenario_ObjectVersioningUsage_section.md)
  + [Serverless examples](service_code_examples_s3_serverless_examples.md)
    + [Invoke a Lambda function from an Amazon S3 trigger](s3_example_serverless_S3_Lambda_section.md)
+ [Amazon S3 Control](service_code_examples_s3-control.md)
  + [Basics](service_code_examples_s3-control_basics.md)
    + [Hello Amazon S3 Control](s3-control_example_s3-control_Hello_section.md)
    + [Learn the basics](s3-control_example_s3-control_Basics_section.md)
    + [Actions](service_code_examples_s3-control_actions.md)
      + [`CreateJob`](s3-control_example_s3-control_CreateJob_section.md)
      + [`DeleteJobTagging`](s3-control_example_s3-control_DeleteJobTagging_section.md)
      + [`DescribeJob`](s3-control_example_s3-control_DescribeJob_section.md)
      + [`GetJobTagging`](s3-control_example_s3-control_GetJobTagging_section.md)
      + [`PutJobTagging`](s3-control_example_s3-control_PutJobTagging_section.md)
      + [`UpdateJobPriority`](s3-control_example_s3-control_UpdateJobPriority_section.md)
      + [`UpdateJobStatus`](s3-control_example_s3-control_UpdateJobStatus_section.md)
+ [S3 Directory Buckets](service_code_examples_s3-directory-buckets.md)
  + [Basics](service_code_examples_s3-directory-buckets_basics.md)
    + [Hello Amazon S3 directory buckets](s3-directory-buckets_example_s3-directory-buckets_Hello_section.md)
    + [Learn the basics](s3-directory-buckets_example_s3-directory-buckets_Scenario_ExpressBasics_section.md)
    + [Actions](service_code_examples_s3-directory-buckets_actions.md)
      + [`AbortMultipartUpload`](s3-directory-buckets_example_s3-directory-buckets_AbortMultipartUpload_section.md)
      + [`CompleteMultipartUpload`](s3-directory-buckets_example_s3-directory-buckets_CompleteMultipartUpload_section.md)
      + [`CopyObject`](s3-directory-buckets_example_s3-directory-buckets_CopyObject_section.md)
      + [`CreateBucket`](s3-directory-buckets_example_s3-directory-buckets_CreateBucket_section.md)
      + [`CreateMultipartUpload`](s3-directory-buckets_example_s3-directory-buckets_CreateMultipartUpload_section.md)
      + [`CreateSession`](s3-directory-buckets_example_s3-directory-buckets_CreateSession_section.md)
      + [`DeleteBucket`](s3-directory-buckets_example_s3-directory-buckets_DeleteBucket_section.md)
      + [`DeleteBucketEncryption`](s3-directory-buckets_example_s3-directory-buckets_DeleteBucketEncryption_section.md)
      + [`DeleteBucketPolicy`](s3-directory-buckets_example_s3-directory-buckets_DeleteBucketPolicy_section.md)
      + [`DeleteObject`](s3-directory-buckets_example_s3-directory-buckets_DeleteObject_section.md)
      + [`DeleteObjects`](s3-directory-buckets_example_s3-directory-buckets_DeleteObjects_section.md)
      + [`GetBucketEncryption`](s3-directory-buckets_example_s3-directory-buckets_GetBucketEncryption_section.md)
      + [`GetBucketPolicy`](s3-directory-buckets_example_s3-directory-buckets_GetBucketPolicy_section.md)
      + [`GetObject`](s3-directory-buckets_example_s3-directory-buckets_GetObject_section.md)
      + [`GetObjectAttributes`](s3-directory-buckets_example_s3-directory-buckets_GetObjectAttributes_section.md)
      + [`HeadBucket`](s3-directory-buckets_example_s3-directory-buckets_HeadBucket_section.md)
      + [`HeadObject`](s3-directory-buckets_example_s3-directory-buckets_HeadObject_section.md)
      + [`ListDirectoryBuckets`](s3-directory-buckets_example_s3-directory-buckets_ListDirectoryBuckets_section.md)
      + [`ListMultipartUploads`](s3-directory-buckets_example_s3-directory-buckets_ListMultipartUploads_section.md)
      + [`ListObjectsV2`](s3-directory-buckets_example_s3-directory-buckets_ListObjectsV2_section.md)
      + [`ListParts`](s3-directory-buckets_example_s3-directory-buckets_ListParts_section.md)
      + [`PutBucketEncryption`](s3-directory-buckets_example_s3-directory-buckets_PutBucketEncryption_section.md)
      + [`PutBucketPolicy`](s3-directory-buckets_example_s3-directory-buckets_PutBucketPolicy_section.md)
      + [`PutObject`](s3-directory-buckets_example_s3-directory-buckets_PutObject_section.md)
      + [`UploadPart`](s3-directory-buckets_example_s3-directory-buckets_UploadPart_section.md)
      + [`UploadPartCopy`](s3-directory-buckets_example_s3-directory-buckets_UploadPartCopy_section.md)
  + [Scenarios](service_code_examples_s3-directory-buckets_scenarios.md)
    + [Create a presigned URL to get an object](s3-directory-buckets_example_s3-directory-buckets_GeneratePresignedGetURLForDirectoryBucket_section.md)