CmdID

CmdID / aws / aws cloudfront

aws cloudfront update-cloud-front-origin-access-identity

Update an origin access identity. AWS CLI reference

1 example 3 options Its page in the AWS CLI reference

Opens CmdID with your command. It is read in your browser and sent nowhere.

Examples

from aws-cli, each command read by CmdID

To update a CloudFront origin access identity

The following update-cloud-front-origin-access-identity example updates the origin access identity (OAI) with the ID E74FTE3AEXAMPLE. The only field that you can update is the OAI's Comment.

To update an OAI, you must have the OAI's ID and ETag. The OAI ID is returned in the output of the create-cloud-front-origin-access-identity and list-cloud-front-origin-access-identities commands. To get the ETag, use the get-cloud-front-origin-access-identity or get-cloud-front-origin-access-identity-config command. Use the --if-match option to provide the OAI's ETag.

aws cloudfront update-cloud-front-origin-access-identity --id E74FTE3AEXAMPLE --if-match E2QWRUHEXAMPLE --cloud-front-origin-access-identity-config CallerReference=cli-example,Comment="Example OAI Updated"Identify
--idThe identity's id.
--if-matchThe value of the ETag header that you received when retrieving the identity's configuration.
--cloud-front-origin-access-identity-configThe identity's configuration information.

You can accomplish the same thing by providing the OAI configuration in a JSON file, as shown in the following example.

aws cloudfront update-cloud-front-origin-access-identity --id E74FTE3AEXAMPLE --if-match E2QWRUHEXAMPLE --cloud-front-origin-access-identity-config file://OAI-config.jsonIdentify
--idThe identity's id.
--if-matchThe value of the ETag header that you received when retrieving the identity's configuration.
--cloud-front-origin-access-identity-configThe identity's configuration information.

Contents of OAI-config.json:

{
    "CallerReference": "cli-example",
    "Comment": "Example OAI Updated"
}

Whether you provide the OAI configuration with a command line argument or a JSON file, the output is the same.

Its output
{
    "ETag": "E9LHASXEXAMPLE",
    "CloudFrontOriginAccessIdentity": {
        "Id": "E74FTE3AEXAMPLE",
        "S3CanonicalUserId": "cd13868f797c227fbea2830611a26fe0a21ba1b826ab4bed9b7771c9aEXAMPLE",
        "CloudFrontOriginAccessIdentityConfig": {
            "CallerReference": "cli-example",
            "Comment": "Example OAI Updated"
        }
    }
}

For more information, see Restrict access to an Amazon S3 origin in the Amazon CloudFront Developer Guide.

Options

3 in the AWS CLI reference
--cloud-front-origin-access-identity-configThe identity's configuration information.
--idThe identity's id.
--if-matchThe value of the ETag header that you received when retrieving the identity's configuration.