- Create a table
- Create a role
- add policy with access to execute lambda
- add policy with dynamodb access
- Create new lambda function
- Use the existing role
- Select runtime
- Load code
- Set CORS in your APP (OPTIONAL)
- Use SDK to hanlde DynamoDB
- Set handler
- example: AWSServerlessDemo1::AWSServerlessDemo1.LambdaEntryPoint::FunctionHandlerAsync
- Assembly::Namespace.Namespace::Class
- Type: REST API
- Endpoint type: Regional
- Create a method
- Type: ANY
- Method request: lambda arn
- Integration request: LAMBDA_PROXY
- Method response: application/json
- HTTP Status: PROXY
- Create resource
- Check as a PROXY
- Set lambda name or arn
- Enable CORS
- Create a method within last resource
- Type: ANY
- Method request: lambda arn
- Integration request: LAMBDA_PROXY
- Method response: application/json
- HTTP Status: PROXY
- Deploy all configurations to required environments
- OPTIONAL: you can ser WEB ACL
- Set CORS rules
- Create s3
- Permissions -> Public access - > Block public access to buckets and objects granted through new public bucket or access point policies (ON)
- Add policy
- Effect: Allow
- Principal: "AWS": "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity EXXXXXXXXXX"
- Action: s3:GetObject
- Resource: "arn:aws:s3:::<BUCKET_NAME>/*"
- Load files
- Create a new one
- Type: WEB
- Origin Domain Name:
- Restict bucket access: yes
- View protocol policy: HTTP and HTTPS
- AWS WAF Web ACL: (pending)
- SSL Certificate Default CloudFront Certificate (...cloudfront.net)
- Default Root Object index.html
- Edit origins
- set origin: s3 name
- Restict bucket access: yes
- Origin Access Identity: Existing
- Identity: CloudFront OAI for aim Frontend S3
- Grant Read Permissions on Bucket: No
- Origin Access Identity is the id that you must use for set principal arn in your s3
- Create new one
- Type: CloudFront distribution
- Select last Cloud Front service
- Add rules
AWS Policy Generator Allow access to CloudFront S3 bucket from another account Policy Permissions Restricting Access to Amazon S3 Amazon S3 bucket only from a CloudFront distribution