Search code examples
c#amazon-cloudfront

create Amazon CloudFront streaming distribution


I am creating an Amazon CloudFront streaming distribution using C#. When I provide my bucket name in s3origin, I get the error "Only Amazon S3 V2 style buckets are acceptable as Origin values". Here is my code:

CreateStreamingDistributionRequest objRequest = new CreateStreamingDistributionRequest();

objRequest.StreamingDistributionConfig.CallerReference = DateTime.Now.ToString(("yyyyMMddHHmmssffff"));
objRequest.StreamingDistributionConfig.Comment = "my First Clund front";
objRequest.StreamingDistributionConfig.Enabled = true;
objRequest.StreamingDistributionConfig.S3Origin = new S3Origin("XXXXXX.s3.amazonaws.com",originAccessIdentity);

CreateStreamingDistributionResponse objCFResponse = client.CreateStreamingDistribution(objRequest);

Can anybody help me create a StreamingDistribution?


Solution

  • I think the problem is that your bucket name should adhere to DNS naming standards. Check out Amazon documentation

    To conform with DNS requirements, we recommend following these additional guidelines when creating buckets:

    Bucket names should not contain underscores (_)

    Bucket names should be between 3 and 63 characters long

    Bucket names should not end with a dash

    Bucket names cannot contain two, adjacent periods

    Bucket names cannot contain dashes next to periods (e.g., "my-.bucket.com" and "my.-bucket" are invalid)

    http://docs.amazonwebservices.com/AmazonS3/latest/dev/index.html?BucketRestrictions.html