Class OriginAccessIdentity
An origin access identity is a special CloudFront user that you can associate with Amazon S3 origins, so that you can secure all or just some of your Amazon S3 content.
Inherited Members
Namespace: Amazon.CDK.AWS.CloudFront
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class OriginAccessIdentity : Resource, IOriginAccessIdentity, IResource, IConstruct, IDependable, IGrantable
Syntax (vb)
Public Class OriginAccessIdentity Inherits Resource Implements IOriginAccessIdentity, IResource, IConstruct, IDependable, IGrantable
Remarks
Resource: AWS::CloudFront::CloudFrontOriginAccessIdentity
ExampleMetadata: infused
Examples
var myBucket = new Bucket(this, "myBucket");
var myOai = new OriginAccessIdentity(this, "myOAI", new OriginAccessIdentityProps {
Comment = "My custom OAI"
});
var s3Origin = S3BucketOrigin.WithOriginAccessIdentity(myBucket, new S3BucketOriginWithOAIProps {
OriginAccessIdentity = myOai
});
new Distribution(this, "myDist", new DistributionProps {
DefaultBehavior = new BehaviorOptions {
Origin = s3Origin
}
});
Synopsis
Constructors
OriginAccessIdentity(Construct, string, IOriginAccessIdentityProps?) | An origin access identity is a special CloudFront user that you can associate with Amazon S3 origins, so that you can secure all or just some of your Amazon S3 content. |
Properties
CloudFrontOriginAccessIdentityS3CanonicalUserId | The Amazon S3 canonical user ID for the origin access identity, used when giving the origin access identity read permission to an object in Amazon S3. |
GrantPrincipal | Derived principal value for bucket access. |
OriginAccessIdentityId | The Origin Access Identity Id (physical id) This was called originAccessIdentityName before. |
OriginAccessIdentityName | (deprecated) The Origin Access Identity Id (physical id) It is misnamed and superseded by the correctly named originAccessIdentityId. |
PROPERTY_INJECTION_ID | Uniquely identifies this class. |
Methods
Arn() | The ARN to include in S3 bucket policy to allow CloudFront access. |
FromOriginAccessIdentityId(Construct, string, string) | Creates a OriginAccessIdentity by providing the OriginAccessIdentityId. |
FromOriginAccessIdentityName(Construct, string, string) | (deprecated) Creates a OriginAccessIdentity by providing the OriginAccessIdentityId. |
Constructors
OriginAccessIdentity(Construct, string, IOriginAccessIdentityProps?)
An origin access identity is a special CloudFront user that you can associate with Amazon S3 origins, so that you can secure all or just some of your Amazon S3 content.
public OriginAccessIdentity(Construct scope, string id, IOriginAccessIdentityProps? props = null)
Parameters
- scope Construct
- id string
- props IOriginAccessIdentityProps
Remarks
Resource: AWS::CloudFront::CloudFrontOriginAccessIdentity
ExampleMetadata: infused
Examples
var myBucket = new Bucket(this, "myBucket");
var myOai = new OriginAccessIdentity(this, "myOAI", new OriginAccessIdentityProps {
Comment = "My custom OAI"
});
var s3Origin = S3BucketOrigin.WithOriginAccessIdentity(myBucket, new S3BucketOriginWithOAIProps {
OriginAccessIdentity = myOai
});
new Distribution(this, "myDist", new DistributionProps {
DefaultBehavior = new BehaviorOptions {
Origin = s3Origin
}
});
Properties
CloudFrontOriginAccessIdentityS3CanonicalUserId
The Amazon S3 canonical user ID for the origin access identity, used when giving the origin access identity read permission to an object in Amazon S3.
public virtual string CloudFrontOriginAccessIdentityS3CanonicalUserId { get; }
Property Value
Remarks
Attribute: true
GrantPrincipal
Derived principal value for bucket access.
public virtual IPrincipal GrantPrincipal { get; }
Property Value
Remarks
Resource: AWS::CloudFront::CloudFrontOriginAccessIdentity
ExampleMetadata: infused
OriginAccessIdentityId
The Origin Access Identity Id (physical id) This was called originAccessIdentityName before.
public virtual string OriginAccessIdentityId { get; }
Property Value
Remarks
Attribute: true
OriginAccessIdentityName
(deprecated) The Origin Access Identity Id (physical id) It is misnamed and superseded by the correctly named originAccessIdentityId.
[Obsolete("use originAccessIdentityId instead")]
public virtual string OriginAccessIdentityName { get; }
Property Value
Remarks
Stability: Deprecated
Attribute: true
PROPERTY_INJECTION_ID
Uniquely identifies this class.
public static string PROPERTY_INJECTION_ID { get; }
Property Value
Remarks
Resource: AWS::CloudFront::CloudFrontOriginAccessIdentity
ExampleMetadata: infused
Methods
Arn()
The ARN to include in S3 bucket policy to allow CloudFront access.
protected virtual string Arn()
Returns
Remarks
Resource: AWS::CloudFront::CloudFrontOriginAccessIdentity
ExampleMetadata: infused
FromOriginAccessIdentityId(Construct, string, string)
Creates a OriginAccessIdentity by providing the OriginAccessIdentityId.
public static IOriginAccessIdentity FromOriginAccessIdentityId(Construct scope, string id, string originAccessIdentityId)
Parameters
Returns
Remarks
Resource: AWS::CloudFront::CloudFrontOriginAccessIdentity
ExampleMetadata: infused
FromOriginAccessIdentityName(Construct, string, string)
(deprecated) Creates a OriginAccessIdentity by providing the OriginAccessIdentityId.
[Obsolete("use `fromOriginAccessIdentityId`")]
public static IOriginAccessIdentity FromOriginAccessIdentityName(Construct scope, string id, string originAccessIdentityName)
Parameters
Returns
Remarks
It is misnamed and superseded by the correctly named fromOriginAccessIdentityId.
Stability: Deprecated