which origin is preferred for CloudFront (very limited usage)

0

Hi All,

Need advise on CloudFront. I have close to 10 files (total size approx. 10gb) in EC2, pushed them to S3 and downloaded them once using CloudFront and deleted files from S3. EC2 => S3 => CF.

I have selected below options in CloudFront

  • Protocol: HTTP and HTTPS,
  • Allowed HTTP methods : GET, HEAD,
  • Price class: Use North America, Europe, Asia, Middle East, and Africa

I noticed there is a huge spike in 2000.0 requests for free for 12 months as part of AWS Free Usage Tier (Global-Requests-Tier1) almost 1200 request. What could be the reason?

EC2 role has only 5 allow actions ("s3:PutObject", "s3:GetObject", "s3:DeleteObject","s3:GetBucketLocation", "s3:ListAllMyBuckets") with a condition of private IP.

I have seen an article stating traffic from EC2 to CloudFront is free and if I use EC2 as origin then

  • Public IP is required for EC2?
  • If yes, then egress from EC2 will be free or chargeable?
4 Answers
1
Accepted Answer

Uploading large files to S3 with AWS CLI automatically results in a multipart upload.
So, you need to change the configuration values listed in the following document.
If you set a high value in the "multipart_threshold" setting, you can upload files to S3 without multipart uploads until the threshold is exceeded.
Also, no setting was found to disable multipart uploads.
https://awscli.amazonaws.com/v2/documentation/api/latest/topic/s3-config.html

multipart_threshold
profile picture
EXPERT
answered 9 months ago
profile pictureAWS
EXPERT
reviewed 9 months ago
  • Thanks a lot, after doing some math able to find out the spike is due to multipart upload.

1

I noticed there is a huge spike in 2000.0 requests for free for 12 months as part of AWS Free Usage Tier (Global-Requests-Tier1) almost 1200 request. What could be the reason?

Without seeing access logs, etc., it is difficult to know exactly, but if access to CloudFront is around 1200 requests, it is probably not that much. CloudFront itself is a service that is open to the public globally, so it is not surprising that it generates a certain amount of requests since it is accessed by an unspecified number of users.

Public IP is required for EC2?

A public IP (public DNS) is required if EC2 is used as the direct origin.
CloudFront origins can only be configured that are publicly accessible from the Internet.
If EC2 is behind ALB, EC2 can use a private subnet.
However, ALBs must be created with Internet-facing.

If yes, then egress from EC2 will be free or chargeable?

Charges are incurred for outbound communication from the VPC.
https://aws.amazon.com/vpc/pricing/?nc1=h_ls

profile picture
EXPERT
answered 9 months ago
profile pictureAWS
EXPERT
reviewed 9 months ago
1

Hi, Fetches from origin to CloudFront are fee : see https://aws.amazon.com/cloudfront/pricing/

Free for origin fetches from any AWS origin such as Amazon Simple Storage Service (S3), 
Amazon Elastic Compute Cloud (EC2), or Elastic Load Balancers.

What it means for you is that you can get read of your EC2 instance (and its public IP address) and store your files in S3 bucket only. S3 storage will be much cheaper than keeping an EC2 instance up & running.

I agree with Riku on the spike: more details are needed to help understanding the situation.

Hope it helps,

Didier

profile pictureAWS
EXPERT
answered 9 months ago
profile pictureAWS
EXPERT
reviewed 9 months ago
0

Hi @Riku_Kobayashi and @Didier_Durand

Thanks for the replies. I have checked "Cost and Usage Reports" for S3 and found below operation performed. I have removed all resources so assuming logs may not be available. I have pushed 3 files from EC2 to S3 and downloaded them from CloudFront. Is it possible to restrict or limit multipart upload for an object upload? I used aws s3 cp command.

MultiObjectDelete
UploadPart
CompleteMultipartUpload
ReadACL
InitiateMultipartUpload
ReadBucketObjectLockConfig
GetLensConfiguration
ReadBucketCors
ReadBucketIntelligentTiering
HeadBucket
ReadVersioningProps
ReadBucketPolicyStatus
ReadAccountPublicAccessBlock
ReadLogProps
ListAccessPoints
ReadCostAllocation
ListAllMyBuckets
ReadLocation
ReadBucketOwnershipControls
ReadBucketPublicAccessBlock
ReadRequestPaymentProps
GetObject
ReadBucketWebsite
ReadBucketServerSideEncryption
ReadBucketPolicy
ListBucket
ReadNotificationProps
WriteBucketPolicy
DeleteObject

S3 Usage report

answered 9 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions