Amazon S3 Presigned URLs
Amazon S3 presigned URLs give time-limited access to specific S3 objects to users or applications that have no AWS credentials of their own. In Domain 4 (Identity and Access Management) of the SCS-C03 exam, they show how temporary, scoped delegation builds on IAM. How they work: A principal with valid permissions, such as an IAM user, role, or federated session, uses an SDK or the AWS CLI to sign a request for one operation (for example GetObject or PutObject) on a specific bucket and key. The Signature Version 4 signature and an expiration value are embedded in the URL query string. Anyone holding the URL can perform that single operation until it expires. No new permissions are created. Key security points: 1. Inherited permissions: The URL can never do more than the signing principal is allowed to do at the time the URL is used. If the signer loses permission, or its credentials are revoked, the URL stops working. 2. Expiration limits: With long-term IAM user access keys, the maximum validity is 7 days. With temporary credentials from an IAM role or AWS STS, the URL becomes invalid when the session ends, even if a longer expiry was requested. URLs generated in the S3 console last at most 12 hours. 3. Revocation: To invalidate a leaked URL, use "Revoke active sessions" on the signing role, which adds a deny policy based on aws:TokenIssueTime. You can also remove the signer's permissions or deactivate its access keys. 4. Restricting usage: Bucket policies can use condition keys to control how presigned URLs are used. s3:signatureAge limits URL age, s3:authType can deny REST-QUERY-STRING requests, and aws:SourceIp or aws:SourceVpce restrict where requests can come from. 5. Encryption: For SSE-KMS objects, the signer also needs the relevant AWS KMS permissions, such as kms:Decrypt for downloads or kms:GenerateDataKey for uploads. Common exam scenarios: browser uploads of user content to private buckets, temporary sharing of private files, remediation after a URL leak, and choosing between S3 presigned URLs and CloudFront signed URLs or signed cookies. CloudFront is the better fit for broad distribution, edge caching, or access to multiple files.
Amazon S3 Presigned URLs: Secure, Temporary Object Access (AWS Certified Security - Specialty)
Amazon S3 Presigned URLs are a core topic in the Identity and Access Management domain of the AWS Certified Security - Specialty exam. They let you grant temporary, scoped access to a single S3 object, so the requester needs no AWS credentials, no IAM user, and no change to a bucket policy. This guide explains why they matter, what they are, how they work, how to secure and revoke them, and how to answer exam questions about them.
1. Why S3 Presigned URLs Are Important
- Least privilege in practice: Buckets stay private, and access is granted per object, per operation, for a limited time.
- No credential distribution: External users, mobile apps, partners, and browsers never receive long-lived AWS access keys.
- Scalable uploads and downloads: Clients transfer data to and from S3 in a single hop, so large files do not pass through your application servers.
- Avoids public buckets: They are a secure alternative to public ACLs or public bucket policies, and they still work when S3 Block Public Access is enabled.
- Security risk if misused: A presigned URL is a bearer token. Anyone who holds it can use it until it expires. The exam tests how to limit, monitor, and invalidate them.
2. What an S3 Presigned URL Is
A presigned URL is a normal S3 object URL with authentication information added as query string parameters. Typical parameters include:
- X-Amz-Algorithm: AWS4-HMAC-SHA256 (Signature Version 4)
- X-Amz-Credential: the signer's access key ID, date, Region, and service
- X-Amz-Date: the time the URL was signed
- X-Amz-Expires: validity period in seconds
- X-Amz-SignedHeaders: the headers included in the signature
- X-Amz-Security-Token: present when the URL is signed with temporary STS credentials
- X-Amz-Signature: the HMAC signature
The URL is tied to a specific bucket, object key, HTTP method (for example GET or PUT), and expiration time. Changing any signed element makes the signature invalid.
3. How Presigned URLs Work
Step 1, Generation: An identity with valid AWS credentials (an IAM user, an IAM role, or temporary STS credentials) generates the URL with an AWS SDK, the AWS CLI (aws s3 presign, which supports GET), or the S3 console. Generation is a local cryptographic operation. No call to S3 is made, and S3 does not check permissions at this stage. You can create a URL for an object you cannot access, but it will fail when used.
Step 2, Distribution: The application gives the URL to the client, for example a browser, mobile app, or partner system.
Step 3, Use: The client sends the HTTP request. S3 checks the signature and expiration, and then evaluates authorization as if the signer made the request.
Step 4, Authorization at request time: S3 evaluates the signer's current permissions: identity policies, bucket policy, SCPs, RCPs, permissions boundaries, session policies, VPC endpoint policies, and KMS key policies. If the signer has lost permission since signing, the URL fails, even if it has not expired.
Expiration rules (heavily tested):
- With SigV4, the maximum expiration is 7 days (604,800 seconds) when signing with long-term IAM user access keys.
- In the S3 console, the maximum is 12 hours.
- When signed with temporary credentials (IAM role, EC2 instance profile, Lambda execution role, STS session), the URL stops working when those credentials expire, even if X-Amz-Expires is longer. Example: a URL signed by a role session that expires in 1 hour stops working after 1 hour, even if it was set for 7 days.
- The shorter of the URL expiration and the credential lifetime wins.
Upload scenarios:
- Presigned PUT: lets a client upload one object to a specific key.
- Presigned POST: used for browser HTML form uploads. It includes a POST policy with conditions such as content-length-range, key prefix (starts-with), Content-Type, and required encryption headers. This gives you more control over what is uploaded.
- Multipart uploads: each UploadPart call can be presigned for very large files.
Encryption interactions:
- SSE-S3: works transparently.
- SSE-KMS: the signer needs kms:Decrypt for downloads and kms:GenerateDataKey for uploads on the KMS key, allowed by the key policy. A common exam trap is a URL returning AccessDenied because the signer lacks KMS permissions.
- SSE-C: the client must send the customer-provided key headers with the request, and those headers must be part of the signature.
- If a bucket policy requires a specific encryption header on PUT, the presigned PUT must include that header in the signature, and the client must send it.
4. Securing Presigned URLs
- Short expirations: use minutes, not days, whenever possible.
- Sign with roles, not IAM user keys: temporary credentials limit the maximum lifetime and avoid long-lived secrets.
- Dedicated signing identity: use a role that can only access the intended prefix and actions. This limits the blast radius.
- HTTPS only: enforce aws:SecureTransport in the bucket policy so URLs are not intercepted in transit.
- Bucket policy condition keys:
- s3:authType: presigned URLs use REST-QUERY-STRING. Deny this value to block presigned URL use on a bucket completely.
- s3:signatureAge: deny requests whose signature is older than a set number of milliseconds. This enforces a maximum URL age across the organization, whatever expiration developers set.
- s3:signatureversion: require AWS4-HMAC-SHA256 (SigV4).
- aws:SourceIp or aws:SourceVpce / aws:SourceVpc: limit where the URL can be used from, such as a corporate network or a VPC endpoint.
- s3:x-amz-server-side-encryption: enforce encryption on uploads.
- Validate uploads: use presigned POST policies with content-length-range and Content-Type, and process uploads with S3 Event Notifications plus Lambda for scanning.
- Protect the URL itself: avoid logging full URLs in application logs, analytics tools, or Referer headers, because the signature is a credential.
5. Revoking Presigned URLs
You cannot revoke one individual presigned URL. Instead, remove the permissions that the URL depends on:
- IAM user keys: deactivate or delete the access key used for signing. Every URL signed with that key stops working.
- IAM role: use Revoke active sessions, which adds a deny policy based on aws:TokenIssueTime, or remove the role's permissions.
- Bucket policy deny: add an explicit deny for the signer, the object, or the prefix. An explicit deny always wins.
- Move, rename, or delete the object, since the URL is tied to a specific key, or use a new object version.
- Design for revocation: sign with a dedicated role so you can revoke its sessions and affect only presigned URLs.
6. Monitoring and Auditing
- CloudTrail data events for S3 record object-level API calls such as GetObject and PutObject. Requests made with a presigned URL appear under the signer's identity, with the authentication type shown as query string authentication.
- S3 server access logs record the requester, source IP, and request details, including the authentication type.
- Amazon GuardDuty S3 Protection can detect anomalous data access patterns.
- IAM Access Analyzer and Macie help confirm that buckets stay private and sensitive data is identified.
7. Presigned URLs Compared with Related Options
- CloudFront signed URLs and signed cookies: use these when content is served through CloudFront with Origin Access Control (OAC). They support caching, custom policies with IP ranges and start or end times, and signed cookies for many files, such as video streaming segments. They are signed with CloudFront key groups, not IAM credentials.
- S3 presigned URLs: one object, one method, IAM-based signing, requests go to the S3 endpoint.
- Public bucket or public ACL: not recommended. It conflicts with Block Public Access and least privilege.
- Cognito identity pools: give app users temporary AWS credentials when they need broader or ongoing S3 access, for example per-user prefixes using policy variables.
- S3 Access Points and Object Lambda: manage access at scale or transform data. These are different from per-object temporary sharing.
- Cross-account access: use bucket policies or IAM roles for ongoing machine-to-machine access between accounts. Use presigned URLs for ad hoc or user-facing sharing.
8. Common Troubleshooting Scenarios
- AccessDenied: the signer lacks s3:GetObject or s3:PutObject, an explicit deny exists in a bucket policy, SCP, or VPC endpoint policy, or the signer lacks KMS key permissions.
- Request has expired: X-Amz-Expires has passed, or the temporary credentials used to sign have expired.
- SignatureDoesNotMatch: the client changed the method, headers (such as Content-Type on PUT), or key, or a Region or clock mismatch exists.
- Works from home but not the office (or the reverse): an aws:SourceIp or aws:SourceVpce condition in the bucket policy.
- URL stopped working after a few hours: it was signed with role or instance profile credentials that expired.
Exam Tips: Answering Questions on Amazon S3 Presigned URLs
1. Look for keywords: temporary access, time-limited, users without AWS credentials, share a single object, let the client upload to a private bucket, keep the bucket private. These point to presigned URLs.
2. Remember who the permissions belong to: the URL carries the signer's permissions, evaluated when the request is made, not when the URL is created.
3. Know the limits: 7 days maximum with SigV4 and IAM user keys, 12 hours in the console, and never longer than the lifetime of the temporary credentials used to sign.
4. Unexpected early expiry? The answer is almost always that the URL was signed with temporary credentials from a role, instance profile, or Lambda function.
5. Revocation questions: pick deactivating the signing access key, revoking role sessions, or adding an explicit deny. Reject answers that claim you can delete or revoke one specific URL.
6. Enforce a maximum age centrally: choose a bucket policy with the s3:signatureAge condition. To block presigned URLs altogether, deny s3:authType = REST-QUERY-STRING.
7. Restrict where URLs can be used: choose aws:SourceIp, aws:SourceVpce, or aws:SecureTransport conditions in the bucket policy.
8. SSE-KMS AccessDenied: check that the signer has KMS permissions in both the IAM policy and the key policy.
9. CloudFront in the scenario: if content is delivered through CloudFront, needs caching, or covers many files, prefer CloudFront signed URLs or signed cookies with OAC over S3 presigned URLs.
10. Browser form uploads with restrictions on size, type, or key prefix point to presigned POST with a POST policy.
11. Block Public Access does not stop presigned URLs, because they are authenticated requests. Do not choose answers that disable Block Public Access to make them work.
12. Prefer the most secure, least-privilege option: short expirations, role-based signing, a dedicated signing role, HTTPS enforcement, and CloudTrail data events for auditing usually beat options involving IAM users, long expirations, or public buckets.
13. Eliminate distractors: creating IAM users for external customers, sharing access keys, making objects public, or relying on obscure object names are almost never correct.
14. Auditing questions: CloudTrail data events and S3 server access logs show presigned URL activity under the signer's identity. Management events alone do not capture GetObject or PutObject calls.
Summary
S3 Presigned URLs provide secure, temporary, object-level access by embedding a SigV4 signature in the URL. Their effective permissions are those of the signer at request time, and their lifetime is capped by both the expiration setting and the credentials used. For the exam, master the expiration limits, revocation methods, bucket policy controls (s3:signatureAge, s3:authType, aws:SourceIp, aws:SourceVpce), KMS interactions, and when to choose CloudFront signed URLs instead.