|
| 1 | +{ |
| 2 | + "title": "Amazon CloudFront signed cookies with Amazon Cognito using Python CDK", |
| 3 | + "description": "Implement Amazon CloudFront signed cookies for private Amazon S3 content access with Amazon Cognito user authentication using AWS CDK with Python.", |
| 4 | + "language": "Python", |
| 5 | + "level": "300", |
| 6 | + "framework": "AWS CDK", |
| 7 | + "introBox": { |
| 8 | + "headline": "How it works", |
| 9 | + "text": [ |
| 10 | + "This pattern creates a secure content delivery solution using CloudFront signed cookies. Users authenticate through Amazon Cognito via API Gateway Lambda functions.", |
| 11 | + "Upon successful login, the Lambda function generates CloudFront signed cookies that grant time-limited access to private S3 content behind the CloudFront distribution.", |
| 12 | + "The CloudFront distribution uses Origin Access Control (OAC) to securely access private S3 content. Public content is accessible without authentication, while private content requires valid signed cookies.", |
| 13 | + "The signed cookies use RSA key pairs, with the private key stored securely in AWS Secrets Manager and the public key configured in a CloudFront Key Group." |
| 14 | + ] |
| 15 | + }, |
| 16 | + "gitHub": { |
| 17 | + "template": { |
| 18 | + "repoURL": "https://github.com/aws-samples/serverless-patterns/tree/main/cloudfront-s3-signed-cookies-cognito", |
| 19 | + "templateURL": "serverless-patterns/cloudfront-s3-signed-cookies-cognito", |
| 20 | + "projectFolder": "cloudfront-s3-signed-cookies-cognito", |
| 21 | + "templateFile": "app.py" |
| 22 | + } |
| 23 | + }, |
| 24 | + "resources": { |
| 25 | + "bullets": [ |
| 26 | + { |
| 27 | + "text": "Serving private content with signed URLs and signed cookies", |
| 28 | + "link": "https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html" |
| 29 | + }, |
| 30 | + { |
| 31 | + "text": "Using CloudFront signed cookies", |
| 32 | + "link": "https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-signed-cookies.html" |
| 33 | + }, |
| 34 | + { |
| 35 | + "text": "Amazon Cognito User Pools", |
| 36 | + "link": "https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools.html" |
| 37 | + }, |
| 38 | + { |
| 39 | + "text": "Restricting access to Amazon S3 content by using an origin access control", |
| 40 | + "link": "https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-restricting-access-to-s3.html" |
| 41 | + } |
| 42 | + ] |
| 43 | + }, |
| 44 | + "deploy": { |
| 45 | + "text": [ |
| 46 | + "cdk deploy" |
| 47 | + ] |
| 48 | + }, |
| 49 | + "testing": { |
| 50 | + "text": [ |
| 51 | + "See the GitHub repo for detailed testing instructions." |
| 52 | + ] |
| 53 | + }, |
| 54 | + "cleanup": { |
| 55 | + "text": [ |
| 56 | + "Delete the stack: <code>cdk destroy</code>." |
| 57 | + ] |
| 58 | + }, |
| 59 | + "services": { |
| 60 | + "from": { |
| 61 | + "serviceName": "Amazon API Gateway", |
| 62 | + "serviceURL": "/api-gateway/" |
| 63 | + }, |
| 64 | + "to": { |
| 65 | + "serviceName": "Amazon CloudFront", |
| 66 | + "serviceURL": "/cloudfront/" |
| 67 | + } |
| 68 | + }, |
| 69 | + "patternArch": { |
| 70 | + "icon1": { |
| 71 | + "x": 15, |
| 72 | + "y": 70, |
| 73 | + "service": "apigw", |
| 74 | + "label": "Amazon API Gateway" |
| 75 | + }, |
| 76 | + "icon2": { |
| 77 | + "x": 38, |
| 78 | + "y": 70, |
| 79 | + "service": "lambda", |
| 80 | + "label": "AWS Lambda" |
| 81 | + }, |
| 82 | + "icon3": { |
| 83 | + "x": 58, |
| 84 | + "y": 30, |
| 85 | + "service": "cognito", |
| 86 | + "label": "Amazon Cognito" |
| 87 | + }, |
| 88 | + "icon5": { |
| 89 | + "x": 68, |
| 90 | + "y": 70, |
| 91 | + "service": "cloudfront", |
| 92 | + "label": "Amazon CloudFront" |
| 93 | + }, |
| 94 | + "icon6": { |
| 95 | + "x": 88, |
| 96 | + "y": 70, |
| 97 | + "service": "s3", |
| 98 | + "label": "Amazon S3" |
| 99 | + }, |
| 100 | + "line1": { |
| 101 | + "from": "icon1", |
| 102 | + "to": "icon2" |
| 103 | + }, |
| 104 | + "line2": { |
| 105 | + "from": "icon2", |
| 106 | + "to": "icon3" |
| 107 | + }, |
| 108 | + "line4": { |
| 109 | + "from": "icon2", |
| 110 | + "to": "icon5" |
| 111 | + }, |
| 112 | + "line5": { |
| 113 | + "from": "icon5", |
| 114 | + "to": "icon6" |
| 115 | + } |
| 116 | + }, |
| 117 | + "patternType": "Serverless", |
| 118 | + "authors": [ |
| 119 | + { |
| 120 | + "name": "Matia Rasetina", |
| 121 | + "bio": "Senior Software Engineer @ Elixirr Digital", |
| 122 | + "linkedin": "in/matiarasetina/" |
| 123 | + } |
| 124 | + ] |
| 125 | +} |
0 commit comments