id
stringlengths 8
78
| source
stringclasses 743
values | chunk_id
int64 1
5.05k
| text
stringlengths 593
49.7k
|
---|---|---|---|
amazon-verified-permissions-user-guide-014 | amazon-verified-permissions-user-guide.pdf | 14 | followed by the policy ID of the determining policy. This means you've successfully created a policy store and tested it using the AWS SDK for Rust. Clean up resources After you have finished exploring your policy store, delete it. To delete a policy store You can delete a policy store by using the delete-policy-store operation, replacing PSEXAMPLEabcdefg111111 with the policy store ID you want to delete. $ aws verifiedpermissions delete-policy-store \ --policy-store-id PSEXAMPLEabcdefg111111 If successful, this command produces no output. API-linked policy stores A common use case is to use Amazon Verified Permissions to authorize user access to APIs hosted on Amazon API Gateway. Using a wizard in the AWS console, you can create role-based access policies for users managed in Amazon Cognito, or any OIDC identity provider (IdP), and deploy an AWS Lambda Authorizer that calls Verified Permissions to evaluate these policies. API-linked policy stores 33 Amazon Verified Permissions User Guide To complete the wizard, choose Set up with API Gateway and an identity provider when you create a new policy store and follow the steps. An API-linked policy store is created and it provisions your authorization model and resources for authorization requests. The policy store has an identity source and a Lambda authorizer that connects API Gateway to Verified Permissions. Once the policy store is created, you can authorize API requests based on users’ group memberships. For example, Verified Permissions can grant access only to users who are members of the Directors group. As your application grows, you can implement fine-grained authorization with user attributes and OAuth 2.0 scopes using the Cedar policy language. For example, Verified Permissions can grant access only to users who have an email attribute in the domain mycompany.co.uk. After you have set up the authorization model for your API, your remaining responsibility is to authenticate users and generate API requests in your application, and to maintain your policy store. To see an demo, see Amazon Verified Permissions - Quick Start Overview and Demo on the Amazon Web Services YouTube channel. Topics • How Verified Permissions authorizes API requests • Considerations for API-linked policy stores • Adding attribute-based access control (ABAC) • Moving to production with AWS CloudFormation • Troubleshooting API-linked policy stores Important Policy stores that you create with the Set up with API Gateway and an identity source option in the Verified Permissions console aren’t intended for immediate deployment to production. With your initial policy store, finalize your authorization model and export the policy store resources to CloudFormation. Deploy Verified Permissions to production programmatically with the AWS Cloud Development Kit (CDK). For more information, see Moving to production with AWS CloudFormation. API-linked policy stores 34 Amazon Verified Permissions User Guide In a policy store that's linked to an API and an identity source, your application presents a user pool token in an authorization header when it makes a request to the API. The identity source of your policy store provides token validation for Verified Permissions. The token forms the principal in authorization requests with the IsAuthorizedWithToken API. Verified Permissions builds policies around the group membership of your users, as presented in a groups claim in identity (ID) and access tokens, for example cognito:groups for user pools. Your API processes the token from your application in a Lambda authorizer and submits it to Verified Permissions for an authorization decision. When your API receives the authorization decision from the Lambda authorizer, it passes the request on to your data source or denies the request. Components of identity source and API Gateway authorization with Verified Permissions • An Amazon Cognito user pool or OIDC IdP that authenticates and groups users. Users' tokens populate the group membership and the principal or context that Verified Permissions evaluates in your policy store. • An API Gateway REST API. Verified Permissions defines actions from API paths and API methods, for example MyAPI::Action::get /photo. • A Lambda function and a Lambda authorizer for your API. The Lambda function takes in bearer tokens from your user pool, requests authorization from Verified Permissions, and returns a decision to API Gateway. The Set up with API Gateway and an identity source workflow automatically creates this Lambda authorizer for you. • A Verified Permissions policy store. The policy store identity source is your Amazon Cognito user pool or OIDC provider group. The policy store schema reflects the configuration of your API, and the policies link user groups to permitted API actions. • An application that authenticates users with your IdP and appends tokens to API requests. How Verified Permissions authorizes API requests When you create a new policy store and select the Set up with API Gateway and an identity source option, Verified Permissions creates policy store schema and policies. The schema and policies reflect API actions and the user groups that you want |
amazon-verified-permissions-user-guide-015 | amazon-verified-permissions-user-guide.pdf | 15 | policy store. The policy store identity source is your Amazon Cognito user pool or OIDC provider group. The policy store schema reflects the configuration of your API, and the policies link user groups to permitted API actions. • An application that authenticates users with your IdP and appends tokens to API requests. How Verified Permissions authorizes API requests When you create a new policy store and select the Set up with API Gateway and an identity source option, Verified Permissions creates policy store schema and policies. The schema and policies reflect API actions and the user groups that you want to authorize to take the actions. Verified Permissions also creates the Lambda function and authorizer. How it works 35 Amazon Verified Permissions User Guide 1. Your user signs in with your application through Amazon Cognito or another OIDC IdP. The IdP issues ID and access tokens with the user's information. 2. Your application stores the JWTs. For more information, see Using tokens with user pools in the Amazon Cognito Developer Guide.. 3. Your user requests data that your application must retrieve from an external API. 4. Your application requests data from a REST API in API Gateway. It appends an ID or access token as a request header. 5. If your API has a cache for the authorization decision, it returns the previous response. If caching is disabled or the API has no current cache, API Gateway passes the request parameters to a token-based Lambda authorizer. How it works 36 Amazon Verified Permissions User Guide 6. The Lambda function sends an authorization request to a Verified Permissions policy store with the IsAuthorizedWithToken API. The Lambda function passes the elements of an authorization decision: a. The user's token as the principal. b. The API method combined with the API path, for example GetPhoto, as the action. c. The term Application as the resource. 7. Verified Permissions validates the token. For more information about how Amazon Cognito tokens are validated, see Authorization with Amazon Verified Permissions in the Amazon Cognito Developer Guide. 8. Verified Permissions evaluates the authorization request against the policies in your policy store and returns an authorization decision. 9. The Lambda authorizer returns an Allow or Deny response to API Gateway. 10.The API returns data or an ACCESS_DENIED response to your application. Your application processes and displays the results of the API request. Considerations for API-linked policy stores When you build an API-linked policy store in the Verified Permissions console, you're creating a test for an eventual production deployment. Before you move to production, establish a fixed configuration for your API and user pool. Consider the following factors: API Gateway caches responses In API-linked policy stores, Verified Permissions creates a Lambda authorizer with an Authorization caching TTL of 120 seconds. You can adjust this value or turn off caching in your authorizer. In an authorizer with caching enabled, your authorizer returns the same response each time until the TTL expires. This can extend the effective lifetime of user pool tokens by a duration that equals the caching TTL of the requested stage. Amazon Cognito groups can be reused Amazon Verified Permissions determines group membership for user pool users from the cognito:groups claim in a user's ID or access token. The value of this claim is an array of the friendly names of the user pool groups that the user belongs to. You can't associate user pool groups with a unique identifier. Considerations 37 Amazon Verified Permissions User Guide User pool groups that you delete and recreate with the same name present to your policy store as the same group. When you delete a group from a user pool, delete all references to the group from your policy store. API-derived namespace and schema are point-in-time Verified Permissions captures your API at a point in time: it only queries your API when you create your policy store. When the schema or name of your API changes, you must update your policy store and Lambda authorizer, or create a new API-linked policy store. Verified Permissions derives the policy store namespace from the name of your API. Lambda function has no VPC configuration The Lambda function that Verified Permissions creates for your API authorizer is launched in the default VPC. By default. APIs that have network access restricted to private VPCs can't communicate with the Lambda function that authorizes access requests with Verified Permissions. Verified Permissions deploys authorizer resources in CloudFormation To create an API-linked policy store, you must sign in a highly-privileged AWS principal to the Verified Permissions console. This user deploys an AWS CloudFormation stack that creates resources across several AWS services. This principal must have the permission to add and modify resources in Verified Permissions, IAM, Lambda, and API Gateway. As a best practice, don't share these credentials with other |
amazon-verified-permissions-user-guide-016 | amazon-verified-permissions-user-guide.pdf | 16 | authorizer is launched in the default VPC. By default. APIs that have network access restricted to private VPCs can't communicate with the Lambda function that authorizes access requests with Verified Permissions. Verified Permissions deploys authorizer resources in CloudFormation To create an API-linked policy store, you must sign in a highly-privileged AWS principal to the Verified Permissions console. This user deploys an AWS CloudFormation stack that creates resources across several AWS services. This principal must have the permission to add and modify resources in Verified Permissions, IAM, Lambda, and API Gateway. As a best practice, don't share these credentials with other administrators in your organization. See Moving to production with AWS CloudFormation for an overview of the resources that Verified Permissions creates. Adding attribute-based access control (ABAC) A typical authentication session with an IdP returns ID and access tokens. You can pass either of these token types as a bearer token in application requests to your API. Depending on your choices when you create your policy store, Verified Permissions expects one of the two types of tokens. Both types carry information about the user’s group membership. For more information about token types in Amazon Cognito, see Using tokens with user pools in the Amazon Cognito Developer Guide. After you create a policy store, you can add and extend policies. For example, you can add new groups to your policies as you add them to your user pool. Because your policy store is already Adding ABAC 38 Amazon Verified Permissions User Guide aware of the way that your user pool presents groups in tokens, you can permit a set of actions for any new group with a new policy. You might also want to extend the group-based model of policy evaluation into a more precise model based on user properties. User pool tokens contain additional user information that can contribute to authorization decisions. ID tokens ID tokens represent a user’s attributes and have a high level of fine-grained access control. To evaluate email addresses, phone numbers, or custom attributes like department and manager, evaluate the ID token. Access tokens Access tokens represent a user’s permissions with OAuth 2.0 scopes. To add a layer of authorization or to set up requests for additional resources, evaluate the access token. For example, you can validate that a user is in the appropriate groups and carries a scope like PetStore.read that generally authorizes access to the API. User pools can add custom scopes to tokens with resource servers and with token customization at runtime. See Mapping identity provider tokens to schema for example policies that process claims in ID and access tokens. Moving to production with AWS CloudFormation API-linked policy stores are a way to quickly build an authorization model for an API Gateway API. They are designed to serve as a testing environment for the authorization component of your application. After you create your test policy store, spend time refining the policies, schema, and Lambda authorizer. You might adjust the architecture of your API, requiring equivalent adjustments to your policy store schema and policies. API-linked policy stores don't automatically update their schema from API architecture–Verified Permissions only polls the API at the time you create a policy store. If your API changes sufficiently, you might have to repeat the process with a new policy store. When your application and authorization model are ready for deployment to production, integrate the API-linked policy store that you developed with your automation processes. As a best practice, we recommend that you export the policy store schema and policies into a AWS CloudFormation template that you can deploy to other AWS accounts and AWS Regions. Moving to production 39 Amazon Verified Permissions User Guide The results of the API-linked policy store process are an initial policy store and a Lambda authorizer. The Lambda authorizer has several dependent resources. Verified Permissions deploys these resources in an automatically-generated CloudFormation stack. To deploy to production, you must collect the policy store and the Lambda authorizer resources into a template. An API-linked policy store is made of the following resources: 1. AWS::VerifiedPermissions::PolicyStore: Copy your schema to the SchemaDefinition object. Escape " characters as \". 2. AWS::VerifiedPermissions::IdentitySource: Copy values from the output of GetIdentitySource from your test policy store and modify as needed. 3. One or more of AWS::VerifiedPermissions::Policy: Copy your policy statement to the Definition object. Escape " characters as \". 4. AWS::Lambda::Function, AWS::IAM::Role, AWS::IAM::Policy, AWS::ApiGateway::Authorizer, AWS::Lambda::Permission The following template is an example policy store. You can append the Lambda authorizer resources from your existing stack to this template. { "AWSTemplateFormatVersion": "2010-09-09", "Resources": { "MyExamplePolicyStore": { "Type": "AWS::VerifiedPermissions::PolicyStore", "Properties": { "ValidationSettings": { "Mode": "STRICT" }, "Description": "ApiGateway: PetStore/test", "Schema": { "CedarJson": "{\"PetStore\":{\"actions\":{\"get /pets\": {\"appliesTo\":{\"principalTypes\":[\"User\"],\"resourceTypes\":[\"Application\"], \"context\":{\"type\":\"Record\",\"attributes\":{}}}},\"get /\":{\"appliesTo\": {\"principalTypes\":[\"User\"],\"resourceTypes\":[\"Application\"],\"context\":{\"type \":\"Record\",\"attributes\":{}}}},\"get /pets/{petId}\":{\"appliesTo\":{\"context \":{\"type\":\"Record\",\"attributes\":{}},\"resourceTypes\":[\"Application\"], \"principalTypes\":[\"User\"]}},\"post /pets\":{\"appliesTo\":{\"principalTypes\": [\"User\"],\"resourceTypes\":[\"Application\"],\"context\":{\"type\":\"Record\", \"attributes\":{}}}}},\"entityTypes\":{\"Application\":{\"shape\":{\"type\":\"Record\", \"attributes\":{}}},\"User\":{\"memberOfTypes\":[\"UserGroup\"],\"shape\":{\"attributes Moving to production 40 Amazon Verified Permissions User Guide |
amazon-verified-permissions-user-guide-017 | amazon-verified-permissions-user-guide.pdf | 17 | your test policy store and modify as needed. 3. One or more of AWS::VerifiedPermissions::Policy: Copy your policy statement to the Definition object. Escape " characters as \". 4. AWS::Lambda::Function, AWS::IAM::Role, AWS::IAM::Policy, AWS::ApiGateway::Authorizer, AWS::Lambda::Permission The following template is an example policy store. You can append the Lambda authorizer resources from your existing stack to this template. { "AWSTemplateFormatVersion": "2010-09-09", "Resources": { "MyExamplePolicyStore": { "Type": "AWS::VerifiedPermissions::PolicyStore", "Properties": { "ValidationSettings": { "Mode": "STRICT" }, "Description": "ApiGateway: PetStore/test", "Schema": { "CedarJson": "{\"PetStore\":{\"actions\":{\"get /pets\": {\"appliesTo\":{\"principalTypes\":[\"User\"],\"resourceTypes\":[\"Application\"], \"context\":{\"type\":\"Record\",\"attributes\":{}}}},\"get /\":{\"appliesTo\": {\"principalTypes\":[\"User\"],\"resourceTypes\":[\"Application\"],\"context\":{\"type \":\"Record\",\"attributes\":{}}}},\"get /pets/{petId}\":{\"appliesTo\":{\"context \":{\"type\":\"Record\",\"attributes\":{}},\"resourceTypes\":[\"Application\"], \"principalTypes\":[\"User\"]}},\"post /pets\":{\"appliesTo\":{\"principalTypes\": [\"User\"],\"resourceTypes\":[\"Application\"],\"context\":{\"type\":\"Record\", \"attributes\":{}}}}},\"entityTypes\":{\"Application\":{\"shape\":{\"type\":\"Record\", \"attributes\":{}}},\"User\":{\"memberOfTypes\":[\"UserGroup\"],\"shape\":{\"attributes Moving to production 40 Amazon Verified Permissions User Guide \":{},\"type\":\"Record\"}},\"UserGroup\":{\"shape\":{\"type\":\"Record\",\"attributes \":{}}}}}}" } } }, "MyExamplePolicy": { "Type": "AWS::VerifiedPermissions::Policy", "Properties": { "Definition": { "Static": { "Description": "Policy defining permissions for testgroup cognito group", "Statement": "permit(\nprincipal in PetStore::UserGroup:: \"us-east-1_EXAMPLE|testgroup\",\naction in [\n PetStore::Action::\"get /\", \n PetStore::Action::\"post /pets\",\n PetStore::Action::\"get /pets\",\n PetStore::Action::\"get /pets/{petId}\"\n],\nresource);" } }, "PolicyStoreId": { "Ref": "MyExamplePolicyStore" } }, "DependsOn": [ "MyExamplePolicyStore" ] }, "MyExampleIdentitySource": { "Type": "AWS::VerifiedPermissions::IdentitySource", "Properties": { "Configuration": { "CognitoUserPoolConfiguration": { "ClientIds": [ "1example23456789" ], "GroupConfiguration": { "GroupEntityType": "PetStore::UserGroup" }, "UserPoolArn": "arn:aws:cognito-idp:us- east-1:123456789012:userpool/us-east-1_EXAMPLE" } }, "PolicyStoreId": { "Ref": "MyExamplePolicyStore" }, Moving to production 41 Amazon Verified Permissions User Guide "PrincipalEntityType": "PetStore::User" }, "DependsOn": [ "MyExamplePolicyStore" ] } } } Troubleshooting API-linked policy stores Use the information here to help you diagnose and fix common issues when you build Amazon Verified Permissions API-linked policy stores. Topics • I updated my policy but the authorization decision didn't change • I attached the Lambda authorizer to my API but it's not generating authorization requests • I received an unexpected authorization decision and want to review the authorization logic • I want to find logs from my Lambda authorizer • My Lambda authorizer doesn't exist • My API is in a private VPC and can't invoke the authorizer • I want to process additional user attributes in my authorization model • I want to add new actions, action context attributes, or resource attributes I updated my policy but the authorization decision didn't change By default, Verified Permissions configures the Lambda authorizer to cache authorization decisions for 120 seconds. Try again after two minutes, or disable cache on your authorizer. For more information, see Enabling API caching to enhance responsiveness in the Amazon API Gateway Developer Guide. I attached the Lambda authorizer to my API but it's not generating authorization requests To begin processing requests, you must deploy the API stage that you attached your authorizer to. For more information, see Deploying a REST API in the Amazon API Gateway Developer Guide. Troubleshooting 42 Amazon Verified Permissions User Guide I received an unexpected authorization decision and want to review the authorization logic The API-linked policy store process creates a Lambda function for your authorizer. Verified Permissions automatically builds the logic of your authorization decisions into the authorizer function. You can go back after you create your policy store to review and update the logic in the function. To locate your Lambda function from the AWS CloudFormation console, choose the Check deployment button on the Overview page of your new policy store. You can also locate your function in the AWS Lambda console. Navigate to the console in the AWS Region of your policy store and search for a function name with a prefix of AVPAuthorizerLambda. If you have create more than one API-linked policy store, use the Last modified time of your functions to correlate them with policy store creation. I want to find logs from my Lambda authorizer Lambda functions collect metrics and log their invocation results in Amazon CloudWatch. To review your logs, locate your function in the Lambda console and choose the Monitor tab. Select View CloudWatch logs and review the entries in the log group. For more information about Lambda function logs, see Using Amazon CloudWatch Logs with AWS Lambda in the AWS Lambda Developer Guide. My Lambda authorizer doesn't exist After you complete setup of an API-linked policy store, you must attach the Lambda authorizer to your API. If you can't locate your authorizer in the API Gateway console, the additional resources for your policy store might have failed or not deployed yet. API-linked policy stores deploy these resources in an AWS CloudFormation stack. Verified Permissions displays a link with the label Check deployment at the end of the creation process. If you already navigated away from this screen, go to the CloudFormation console and search recent stacks for a name that's prefixed with AVPAuthorizer-<policy store ID>. CloudFormation provides valuable troubleshooting information in the output of a stack deployment. For help troubleshooting CloudFormation stacks, see Troubleshooting CloudFormation in the AWS CloudFormation User Guide. Troubleshooting 43 Amazon Verified Permissions User Guide My API is in a private VPC and can't invoke the authorizer Verified Permissions doesn't support access to Lambda authorizers through VPC endpoints. You must open a network path |
amazon-verified-permissions-user-guide-018 | amazon-verified-permissions-user-guide.pdf | 18 | with the label Check deployment at the end of the creation process. If you already navigated away from this screen, go to the CloudFormation console and search recent stacks for a name that's prefixed with AVPAuthorizer-<policy store ID>. CloudFormation provides valuable troubleshooting information in the output of a stack deployment. For help troubleshooting CloudFormation stacks, see Troubleshooting CloudFormation in the AWS CloudFormation User Guide. Troubleshooting 43 Amazon Verified Permissions User Guide My API is in a private VPC and can't invoke the authorizer Verified Permissions doesn't support access to Lambda authorizers through VPC endpoints. You must open a network path between your API and the Lambda function that serves as your authorizer. I want to process additional user attributes in my authorization model The API-linked policy store process derives Verified Permissions policies from the groups claim in users' tokens. To update your authorization model to consider additional user attributes, integrate those attributes in your policies. You can map many claims in ID and access tokens from Amazon Cognito user pools to Verified Permissions policy statements. For example, most users have an email claim in their ID token. For more information about adding claims from your identity source to policies, see Mapping identity provider tokens to schema. I want to add new actions, action context attributes, or resource attributes An API-linked policy store and the Lambda authorizer that it creates are a point-in-time resource. They reflect the state of your API at the time of creation. The policy store schema doesn't assign any context attributes to actions, nor any attributes or parents to the default Application resource. When you add actions—paths and methods—to your API, you must update your policy store to be aware of the new actions. You must also update your Lambda authorizer to process authorization requests for the new actions. You can start again with a new policy store or you can update your existing policy store. To update your existing policy store, locate your function. Examine the logic in the automatically- generated function and update it to process the new actions, attributes, or context. Then edit your schema to include the new actions and attributes. Deleting policy stores You can delete Amazon Verified Permissions policy stores using the AWS Management Console or the AWS CLI. Deleting a policy store permanently deletes the schema and any policies in the policy store. Deleting policy stores 44 Amazon Verified Permissions User Guide Deletion protection prevents accidental deletion of a policy store. Deletion protection is enabled on all new policy stores created through the AWS Management Console. By contrast, it is disabled for all policy stores created through an API or SDK call. You may want to delete policy stores for the following reasons: • You have reached the quota of available policy stores in a given Region. For more information, see Quotas for resources. • You're no longer supporting a tenant in a multi-tenant application and, therefore, no longer need that policy store. AWS Management Console To delete a policy store 1. Open the Verified Permissions console. Choose your policy store. 2. In the navigation pane on the left, choose Settings. 3. Choose Delete this policy store. 4. Type delete in the text box and choose Delete. Note If deletion protection is enabled, you'll need to disable it before you can choose Delete. To disable it, select Disable deletion protection. AWS CLI To delete a policy store You can delete a policy store by using the delete-policy-store operation, replacing PSEXAMPLEabcdefg111111 with the policy store ID you want to delete. $ aws verifiedpermissions delete-policy-store \ --policy-store-id PSEXAMPLEabcdefg111111 If successful, this command produces no output. Deleting policy stores 45 Amazon Verified Permissions User Guide Note If deletion protection is enabled for this policy store, you must first run the update- policy-store operation and disable deletion protection. aws verifiedpermissions update-policy-store \ --deletion-protection "DISABLED" \ --policy-store-id PSEXAMPLEabcdefg111111 Deleting policy stores 46 Amazon Verified Permissions User Guide Amazon Verified Permissions policy store schema A schema is a declaration of the structure of the entity types supported by your application, and the actions your application may provide in authorization requests. To see the difference between how Verified Permissions and Cedar handles schemas, see Schema support. For more information, see Cedar schema format in the Cedar policy language Reference Guide. Note The use of schemas in Verified Permissions is optional, but they are highly recommended for production software. When you create a new policy, Verified Permissions can use the schema to validate the entities and attributes referenced in the scope and conditions to avoid typos and mistakes in policies that can lead to confusing system behavior. If you activate policy validation, then all new policies must conform with the schema. AWS Management Console To create a schema 1. Open the Verified Permissions console. Choose your policy store. |
amazon-verified-permissions-user-guide-019 | amazon-verified-permissions-user-guide.pdf | 19 | more information, see Cedar schema format in the Cedar policy language Reference Guide. Note The use of schemas in Verified Permissions is optional, but they are highly recommended for production software. When you create a new policy, Verified Permissions can use the schema to validate the entities and attributes referenced in the scope and conditions to avoid typos and mistakes in policies that can lead to confusing system behavior. If you activate policy validation, then all new policies must conform with the schema. AWS Management Console To create a schema 1. Open the Verified Permissions console. Choose your policy store. 2. In the navigation pane on the left, choose Schema. 3. Choose Create schema. AWS CLI To submit a new schema, or overwrite an existing schema by using the AWS CLI. You can create a policy store by running a AWS CLI command similar to the following example. Consider a schema that contains the following Cedar content: { "MySampleNamespace": { "actions": { "remoteAccess": { 47 Amazon Verified Permissions User Guide "appliesTo": { "principalTypes": [ "Employee" ] } } }, "entityTypes": { "Employee": { "shape": { "type": "Record", "attributes": { "jobLevel": {"type": "Long"}, "name": {"type": "String"} } } } } } } You must first escape the JSON into a single line string, and preface it with a declaration of its data type: cedarJson. The following example uses the following contents of schema.json file that contains the escaped version of the JSON schema. Note The example here is line wrapped for readability. You must have the entire file on a single line for the command to accept it. {"cedarJson": "{\"MySampleNamespace\": {\"actions\": {\"remoteAccess\": {\"appliesTo \": {\"principalTypes\": [\"Employee\"]}}},\"entityTypes\": {\"Employee\": {\"shape\": {\"attributes\": {\"jobLevel\": {\"type\": \"Long\"},\"name\": {\"type\": \"String \"}}, \"type\": \"Record\"}}}}}"} $ aws verifiedpermissions put-schema \ --definition file://schema.json \ --policy-store PSEXAMPLEabcdefg111111 { "policyStoreId": "PSEXAMPLEabcdefg111111", 48 Amazon Verified Permissions User Guide "namespaces": [ "MySampleNamespace" ], "createdDate": "2023-07-17T21:07:43.659196+00:00", "lastUpdatedDate": "2023-08-16T17:03:53.081839+00:00" } AWS SDKs You can create a policy store using the PutSchema API. For more information, see PutSchema in the Amazon Verified Permissions API Reference Guide. Editing policy store schemas When you select Schema in the Amazon Verified Permissions console, the Entity types and Actions that make up your schema are displayed. You can view edit your schema in either Visual mode or JSON mode. Visual mode lets you update the schema by adding new types and actions using various wizards. Using JSON mode, you can start updating the JSON code of the schema directly in the JSON editor. Visual Mode The visual schema editor begins with a series of diagrams that illustrate the relationships between the entities in your schema. Choose Expand to maximize your view of the diagrams. There are two diagrams available: • Actions diagram – The Actions diagram view lists the types of Principals you have configured in your policy store, the Actions they are eligible to perform, and the Resources that they are eligible to perform actions on. The lines between entities indicate your ability to create a policy that allows a principal to take an action on a resource. If your actions diagram doesn't indicate a relationship between two entities, you must create that relationship between them before you can allow or deny it in policies. Select an entity to see a properties overview and drill down to view full details. Choose Filter by this [action | resource type | principal type] to see an entity in a view with only its own connections. • Entity types diagram – The Entity types diagram focuses on the relationships between principals and resources. When you want to understand the complex nested parent relationships in your schema, review this diagram. Hover over an entity to drill down into the parent relationships that it has. Editing schema 49 Amazon Verified Permissions User Guide Under the diagrams are list views of the Entity types and Actions in your schema. The list view is useful when you want to immediately view the details of a specific action or entity type. Select any entity to view details. To edit a Verified Permissions schema in Visual mode 1. Open the Verified Permissions console. Choose your policy store. 2. In the navigation pane on the left, choose Schema. 3. Choose Visual mode. Review the entity-relationship diagrams and plan the changes that you want to make to your schema. You can optionally Filter by one entity to examine its individual connections to other entities. 4. Choose Edit schema. 5. 6. 7. 8. In the Details section, type a Namespace for your schema. In the Entity types section, choose Add new entity type. Type the name of the entity. (Optional) Choose Add a parent to add parent entities that the new entity is a member of. To remove a parent that has been added to the entity, choose Remove next to the |
amazon-verified-permissions-user-guide-020 | amazon-verified-permissions-user-guide.pdf | 20 | Visual mode. Review the entity-relationship diagrams and plan the changes that you want to make to your schema. You can optionally Filter by one entity to examine its individual connections to other entities. 4. Choose Edit schema. 5. 6. 7. 8. In the Details section, type a Namespace for your schema. In the Entity types section, choose Add new entity type. Type the name of the entity. (Optional) Choose Add a parent to add parent entities that the new entity is a member of. To remove a parent that has been added to the entity, choose Remove next to the name of the parent. 9. Choose Add an attribute to add attributes to the entity. Type the Attribute name and choose the Attribute type for each attribute of the entity. Verified Permissions uses the specified attribute values when verifying policies against the schema. Select whether each attribute is Required. To remove an attribute that has been added to the entity, choose Remove next to the attribute. 10. Choose Add entity type to add the entity to the schema. 11. In the Actions section, choose Add new action. 12. Type the name of the action. 13. (Optional) Choose Add a resource to add resource types for which the action applies to. To remove a resource type that has been added to the action, choose Remove next to the name of the resource type. 14. (Optional) Choose Add a principal to add a principal type that the action applies to. To remove a principal type that has been added to the action, choose Remove next to the name of the principal type. Editing schema 50 Amazon Verified Permissions User Guide 15. Choose Add an attribute to add attributes that can be added to the context of an action in your authorization requests. Enter the Attribute name and choose the Attribute type for each attribute. Verified Permissions uses the specified attribute values when verifying policies against the schema. Select whether each attribute is Required. To remove an attribute that has been added to the action, choose Remove next to the attribute. 16. Choose Add action. 17. After all the entity types and actions have been added to the schema, choose Save changes. JSON mode While making updates, you'll notice the JSON editor validates your code against JSON syntax and will identify errors and warnings as you edit, making it easier for you to find issues quickly. In addition, you don't need to worry about the formatting of the JSON, simply choose Format JSON once you've made your updates and the format will be updated to match expected JSON formatting. To edit a Verified Permissions schema in JSON mode 1. Open the Verified Permissions console. Choose your policy store. 2. In the navigation pane on the left, choose Schema. 3. Choose JSON mode and then choose Edit schema. 4. Enter the content of your JSON schema in the Contents field. You can't save updates to your schema until you resolve all syntax errors. You can choose Format JSON to format the JSON syntax of your schema with the recommended spacing and indentation. 5. Choose Save changes. Editing schema 51 Amazon Verified Permissions User Guide Enabling Amazon Verified Permissions policy validation mode You can set the policy validation mode in Verified Permissions to control whether policy changes are validated against the schema in your policy store. Important When you turn on policy validation, all attempts to create or update a policy or policy template are validated against the schema in the policy store. Verified Permissions rejects the request attempt if validation fails. For this reason, we recommend leaving validation off while you're developing your application and turning it on for testing and leaving it on while your application is in production. AWS Management Console To set the policy validation mode for a policy store 1. Open the Verified Permissions console. Choose your policy store. 2. Choose Settings. 3. In the Policy validation mode section, choose Modify. 4. Do one of the following: • To activate policy validation and enforce that all policy changes must be validated against your schema, choose the Strict (recommended) radio button. • To turn off policy validation for policy changes, choose the Off radio button. Type confirm to confirm that updates to policies will no longer be validated against your schema. 5. Choose Save changes. AWS CLI To set the validation mode for a policy store 52 Amazon Verified Permissions User Guide You can change the validation mode for a policy store by using the UpdatePolicyStore operation and specifying a different value for the ValidationSettings parameter. $ aws verifiedpermissions update-policy-store \ --validation-settings "mode=OFF", --policy-store-id PSEXAMPLEabcdefg111111 { "createdDate": "2023-05-17T18:36:10.134448+00:00", "lastUpdatedDate": "2023-05-17T18:36:10.134448+00:00", "policyStoreId": "PSEXAMPLEabcdefg111111", "validationSettings": { "Mode": "OFF" } } For more information, see Policy validation in the Cedar policy language Reference Guide. |
amazon-verified-permissions-user-guide-021 | amazon-verified-permissions-user-guide.pdf | 21 | the Off radio button. Type confirm to confirm that updates to policies will no longer be validated against your schema. 5. Choose Save changes. AWS CLI To set the validation mode for a policy store 52 Amazon Verified Permissions User Guide You can change the validation mode for a policy store by using the UpdatePolicyStore operation and specifying a different value for the ValidationSettings parameter. $ aws verifiedpermissions update-policy-store \ --validation-settings "mode=OFF", --policy-store-id PSEXAMPLEabcdefg111111 { "createdDate": "2023-05-17T18:36:10.134448+00:00", "lastUpdatedDate": "2023-05-17T18:36:10.134448+00:00", "policyStoreId": "PSEXAMPLEabcdefg111111", "validationSettings": { "Mode": "OFF" } } For more information, see Policy validation in the Cedar policy language Reference Guide. 53 Amazon Verified Permissions User Guide Amazon Verified Permissions policies A policy is a statement that either permits or forbids a principal to take one or more actions on a resource. Each policy is evaluated independently of every other policy. For more information about how Cedar policies are structured and evaluated, see Cedar policy validation against schema in the Cedar policy language Reference Guide. Important When you write Cedar policies that reference principals, resources and actions, you can define the unique identifiers used for each of those elements. We strongly recommend that you follow these best practices: • Use universally unique identifiers (UUIDs) for all principal and resource identifiers. For example, if user jane leaves the company, and you later let someone else use the name jane, then that new user automatically gets access to everything granted by policies that still reference User::"jane". Cedar can’t distinguish between the new user and the old. This applies to both principal and resource identifiers. Always use identifiers that are guaranteed unique and never reused to ensure that you don’t unintentionally grant access because of the presence of an old identifier in a policy. Where you use a UUID for an entity, we recommend that you follow it with the // comment specifier and the ‘friendly’ name of your entity. This helps to make your policies easier to understand. For example: principal == Role::"a1b2c3d4-e5f6-a1b2-c3d4- EXAMPLE11111", // administrators • Do not include personally identifying, confidential, or sensitive information as part of the unique identifier for your principals or resources. These identifiers are included in log entries shared in AWS CloudTrail trails. Topics • Creating Amazon Verified Permissions static policies • Editing Amazon Verified Permissions static policies • Adding context • Using the Amazon Verified Permissions test bench 54 Amazon Verified Permissions User Guide • Amazon Verified Permissions example policies Creating Amazon Verified Permissions static policies You can create a static policy for principals to permit or forbid them from performing specified actions on specified resources for your application. A static policy has specific values included for the principal and resource and are ready to be used in authorization decisions. AWS Management Console To create a static policy 1. Open the Verified Permissions console. Choose your policy store. 2. In the navigation pane on the left, choose Policies. 3. Choose Create policy and then choose Create static policy. Note If you have a policy statement you'd like to use, skip to Step 8 and paste the policy into the Policy section on the next page. 4. In the Policy effect section, choose whether the policy will Permit or Forbid when a request matches the policy. If you choose Permit, the policy allows the principals to perform the actions on the resources. Conversely, if you choose Forbid, the policy doesn't allow the principals to perform the actions on the resources. 5. In the Principals scope field, choose the scope of the principals that the policy will apply to. • Choose Specific principal to apply the policy to a specific principal. Specify the entity type and identifier for the principal that will be permitted or forbidden to take the actions specified in the policy. • Choose Group of principals to apply the policy to a group of principals. Type the principal group name in the Group of principals field. • Choose All principals to apply the policy to all principals in your policy store. 6. In the Resources scope field, choose the scope of the resources that the policy will apply to. Creating static policies 55 Amazon Verified Permissions User Guide • Choose Specific resources to apply the policy to a specific resource. Specify the entity type and identifier for the resource that the policy should apply to. • Choose Group of resources to apply the policy to a group of resources. Type the resource group name in the Group of resources field. • Choose All resources to apply the policy to all resources in your policy store. 7. In the Actions scope section, choose the scope of the resources that the policy will apply to. • Choose Specific set of actions to apply the policy to a set of actions. Select the check boxes next to the |
amazon-verified-permissions-user-guide-022 | amazon-verified-permissions-user-guide.pdf | 22 | policy to a specific resource. Specify the entity type and identifier for the resource that the policy should apply to. • Choose Group of resources to apply the policy to a group of resources. Type the resource group name in the Group of resources field. • Choose All resources to apply the policy to all resources in your policy store. 7. In the Actions scope section, choose the scope of the resources that the policy will apply to. • Choose Specific set of actions to apply the policy to a set of actions. Select the check boxes next to the actions to apply the policy. • Choose All actions to apply the policy to all actions in your policy store. 8. Choose Next. 9. In the Policy section, review your Cedar policy. You can choose Format to format the syntax of your policy with the recommended spacing and indentation. For more information, see Basic policy construction in Cedar in the Cedar policy language Reference Guide. 10. In the Details section, type an optional description of the policy. 11. Choose Create policy. AWS CLI To create a static policy You can create a static policy by using the CreatePolicy operation. The following example creates a simple static policy. $ aws verifiedpermissions create-policy \ --definition "{ \"static\": { \"Description\": \"MyTestPolicy\", \"Statement\": \"permit(principal,action,resource) when {principal.owner == resource.owner};\"}}" \ --policy-store-id PSEXAMPLEabcdefg111111 { "Arn": "arn:aws:verifiedpermissions::123456789012:policy/PSEXAMPLEabcdefg111111/ SPEXAMPLEabcdefg111111", "createdDate": "2023-05-16T20:33:01.730817+00:00", "lastUpdatedDate": "2023-05-16T20:33:01.730817+00:00", "policyId": "SPEXAMPLEabcdefg111111", "policyStoreId": "PSEXAMPLEabcdefg111111", Creating static policies 56 Amazon Verified Permissions User Guide "policyType": "STATIC" } Editing Amazon Verified Permissions static policies You can edit an existing static policy in your policy store. You can only directly update static policies. To change a template-linked policy, you must update the policy template. For more information, see Editing Amazon Verified Permissions policy templates. You can change the following elements of a static policy: • The action referenced by the policy. • A condition clause, such as when and unless. You can't change the following elements of a static policy. To change any of these elements you will need to delete and re-created the policy. • A policy from a static policy to a template-linked policy. • The effect of a static policy from permit or forbid. • The principal referenced by a static policy. • The resource referenced by a static policy. AWS Management Console To edit a static policy 1. Open the Verified Permissions console. Choose your policy store. 2. In the navigation pane on the left, choose Policies. 3. Choose the radio button next to the static policy to edit and then choose Edit. 4. In the Policy body section, update the action or condition clause of your static policy. You can't update the policy effect, principal, or resource of the policy. 5. Choose Update policy. Editing static policies 57 Amazon Verified Permissions User Guide Note If policy validation is enabled in the policy store, then updating a static policy causes Verified Permissions to validate the policy against the schema in the policy store. If the updated static policy doesn't pass validation, the operation fails and the update isn't saved. AWS CLI To edit a static policy You can edit a static policy by using the UpdatePolicy operation. The following example edits a simple static policy. The example uses the file definition.txt to contain the policy definition. { "static": { "description": "Grant everyone of janeFriends UserGroup access to the vacationFolder Album", "statement": "permit(principal in UserGroup::\"janeFriends\", action, resource in Album::\"vacationFolder\" );" } } The following command references that file. $ aws verifiedpermissions create-policy \ --definition file://definition.txt \ --policy-store-id PSEXAMPLEabcdefg111111 { "createdDate": "2023-06-12T20:33:37.382907+00:00", "lastUpdatedDate": "2023-06-12T20:33:37.382907+00:00", "policyId": "SPEXAMPLEabcdefg111111", "policyStoreId": "PSEXAMPLEabcdefg111111", "policyType": "STATIC", "principal": { "entityId": "janeFriends", Editing static policies 58 Amazon Verified Permissions User Guide "entityType": "UserGroup" }, "resource": { "entityId": "vacationFolder", "entityType": "Album" } } Adding context Context is the information that's relevant to policy decisions, but not part of the identity of your principal, action, or resource. Access token claim are context. You might want to allow an action only from a set of source IP addresses, or only if your user has signed in with MFA. Your application has access to this contextual session data and must populate it to authorization requests. The context data in a Verified Permissions authorization request must be JSON-formatted in a contextMap element. The examples that illustrate this content come from a sample policy store. To follow along, create the DigitalPetStore sample policy store in your testing environment. The following context object declares one of each Cedar data type for an application based on the sample DigitalPetStore policy store. "context": { "contextMap": { "MfaAuthorized": { "boolean": true }, "AccountCodes": { "set": [ { "long": 111122223333 }, { "long": 444455556666 }, { "long": 123456789012 } ] }, 59 User Guide Amazon Verified Permissions "UserAgent": { "string": "My UserAgent 1.12" }, "RequestedOrderCount": |
amazon-verified-permissions-user-guide-023 | amazon-verified-permissions-user-guide.pdf | 23 | in a Verified Permissions authorization request must be JSON-formatted in a contextMap element. The examples that illustrate this content come from a sample policy store. To follow along, create the DigitalPetStore sample policy store in your testing environment. The following context object declares one of each Cedar data type for an application based on the sample DigitalPetStore policy store. "context": { "contextMap": { "MfaAuthorized": { "boolean": true }, "AccountCodes": { "set": [ { "long": 111122223333 }, { "long": 444455556666 }, { "long": 123456789012 } ] }, 59 User Guide Amazon Verified Permissions "UserAgent": { "string": "My UserAgent 1.12" }, "RequestedOrderCount": { "long": 4 }, "NetworkInfo": { "record": { "IPAddress": { "string": "192.0.2.178" }, "Country": { "string": "United States of America" }, "SSL": { "boolean": true } } }, "approvedBy": { "entityIdentifier": { "entityId": "Bob", "entityType": "DigitalPetStore::User" } } } } Data types in authorization context Boolean A binary true or false value. In the example, the boolean value of true for MfaAuthenticated indicates that the customer has performed multi-factor authentication before requesting to view their order. Set A collection of context elements. Set members can be all the same type, like in this example, or of different types, including a nested set. In the example, the customer is associated with 3 different accounts. 60 Amazon Verified Permissions String User Guide A sequence of letters, numbers, or symbols, enclosed in " characters. In the example, the UserAgent string represents the browser that the customer used to request to view their order. Long An integer. In the example, the RequestedOrderCount indicates that this request is part of a batch that resulted from the customer asking to view four of their past orders. Record A collection of attributes. You must declare these attributes in the request context. A policy store with a schema must include this entity and the attributes of the entity in the schema. In the example, the NetworkInfo record contains information about the user's originating IP, the geolocation of that IP as determined by the client, and encryption in transit. EntityIdentifier A reference to an entity and attributes declared in the entities element of the request. In the example, the user's order was approved by employee Bob. To test this example context in the example DigitalPetStore app, you must update your request entities, your policy store schema, and the static policy with the description Customer Role - Get Order. Modifying DigitalPetStore to accept authorization context Initially, DigitalPetStore is not a very complex policy store. It doesn't include any preconfigured policies or context attributes to support the context that we have presented. To evaluate an example authorization request with this context information, make the following modifications to your policy store and your authorization request. For context examples with access token information as the context, see Mapping access tokens. Schema Apply the following updates to your policy store schema to support the new context attributes. Update GetOrder in actions as follows. "GetOrder": { Evaluate example context 61 Amazon Verified Permissions User Guide "memberOf": [], "appliesTo": { "resourceTypes": [ "Order" ], "context": { "type": "Record", "attributes": { "UserAgent": { "required": true, "type": "String" }, "approvedBy": { "name": "User", "required": true, "type": "Entity" }, "AccountCodes": { "type": "Set", "required": true, "element": { "type": "Long" } }, "RequestedOrderCount": { "type": "Long", "required": true }, "MfaAuthorized": { "type": "Boolean", "required": true } } }, "principalTypes": [ "User" ] } } To reference the record data type named NetworkInfo in your request context, create a commonType construct in your schema as follows. A commonType construct is a shared set of attributes that you can apply to different entities. Evaluate example context 62 Amazon Verified Permissions User Guide Note The Verified Permissions visual schema editor currently doesn't support commonType constructs. When you add them to your schema, you can no longer view your schema in Visual mode. "commonTypes": { "NetworkInfo": { "attributes": { "IPAddress": { "type": "String", "required": true }, "SSL": { "required": true, "type": "Boolean" }, "Country": { "required": true, "type": "String" } }, "type": "Record" } } Policy The following policy sets up conditions that must be fulfilled by each of the provided context elements. It builds on the existing static policy with the description Customer Role - Get Order. This policy initially only requires that the principal that makes a request is the owner of the resource. permit ( principal in DigitalPetStore::Role::"Customer", action in [DigitalPetStore::Action::"GetOrder"], resource ) when { principal == resource.owner && context.MfaAuthorized == true && Evaluate example context 63 Amazon Verified Permissions User Guide context.UserAgent like "*My UserAgent*" && context.RequestedOrderCount <= 4 && context.AccountCodes.contains(111122223333) && context.NetworkInfo.Country like "*United States*" && context.NetworkInfo.SSL == true && context.NetworkInfo.IPAddress like "192.0.2.*" && context.approvedBy in DigitalPetStore::Role::"Employee" }; We have now required that the request to retrieve an order meets the additional context conditions that we added to the |
amazon-verified-permissions-user-guide-024 | amazon-verified-permissions-user-guide.pdf | 24 | Role - Get Order. This policy initially only requires that the principal that makes a request is the owner of the resource. permit ( principal in DigitalPetStore::Role::"Customer", action in [DigitalPetStore::Action::"GetOrder"], resource ) when { principal == resource.owner && context.MfaAuthorized == true && Evaluate example context 63 Amazon Verified Permissions User Guide context.UserAgent like "*My UserAgent*" && context.RequestedOrderCount <= 4 && context.AccountCodes.contains(111122223333) && context.NetworkInfo.Country like "*United States*" && context.NetworkInfo.SSL == true && context.NetworkInfo.IPAddress like "192.0.2.*" && context.approvedBy in DigitalPetStore::Role::"Employee" }; We have now required that the request to retrieve an order meets the additional context conditions that we added to the request. 1. The user must have signed in with MFA. 2. The user's web browser User-Agent must contain the string My UserAgent. 3. The user must have requested to view 4 or fewer orders. 4. One of the user's account codes must be 111122223333. 5. The user's IP address must originate in the United States, they must be on an encrypted session, and their IP address must begin with 192.0.2.. 6. An employee must have approved their order. In the entities element of the authorization request, we will declare a user Bob who has the role of Employee. Request body After you configure your policy store with the appropriate schema and policy, you can present this authorization request to the Verified Permissions API operation IsAuthorized. Note that the entities segment contains a definition of Bob, a user with a role of Employee. { "principal": { "entityType": "DigitalPetStore::User", "entityId": "Alice" }, "action": { "actionType": "DigitalPetStore::Action", "actionId": "GetOrder" }, "resource": { "entityType": "DigitalPetStore::Order", "entityId": "1234" Evaluate example context 64 Amazon Verified Permissions User Guide }, "context": { "contextMap": { "MfaAuthorized": { "boolean": true }, "UserAgent": { "string": "My UserAgent 1.12" }, "RequestedOrderCount":{ "long": 4 }, "AccountCodes": { "set": [ {"long": 111122223333}, {"long": 444455556666}, {"long": 123456789012} ] }, "NetworkInfo": { "record": { "IPAddress": {"string": "192.0.2.178"}, "Country": {"string": "United States of America"}, "SSL": {"boolean": true} } }, "approvedBy": { "entityIdentifier": { "entityId": "Bob", "entityType": "DigitalPetStore::User" } } } }, "entities": { "entityList": [ { "identifier": { "entityType": "DigitalPetStore::User", "entityId": "Alice" }, "attributes": { "memberId": { "string": "801b87f2-1a5c-40b3-b580-eacad506d4e6" Evaluate example context 65 Amazon Verified Permissions User Guide } }, "parents": [ { "entityType": "DigitalPetStore::Role", "entityId": "Customer" } ] }, { "identifier": { "entityType": "DigitalPetStore::User", "entityId": "Bob" }, "attributes": { "memberId": { "string": "49d9b81e-735d-429c-989d-93bec0bcfd8b" } }, "parents": [ { "entityType": "DigitalPetStore::Role", "entityId": "Employee" } ] }, { "identifier": { "entityType": "DigitalPetStore::Order", "entityId": "1234" }, "attributes": { "owner": { "entityIdentifier": { "entityType": "DigitalPetStore::User", "entityId": "Alice" } } }, "parents": [] } ] }, "policyStoreId": "PSEXAMPLEabcdefg111111" Evaluate example context 66 Amazon Verified Permissions } User Guide Using the Amazon Verified Permissions test bench Use the Verified Permissions test bench to test and troubleshoot Verified Permissions policies by running authorization requests against them. The test bench uses the parameters that you specify to determine whether the Cedar policies in your policy store would authorize the request. You can toggle between Visual mode and JSON mode while testing authorization requests. For more information about how Cedar policies are structured and evaluated, see Basic policy construction in Cedar in the Cedar policy language Reference Guide. Note When you make an authorization request using Verified Permissions, you can provide the list of principals and resources as part of the request in the Additional entities section. However, you can't include the details about the actions. They must be specified in the schema or inferred from the request. You can't put an action in the Additional entities section. For a visual overview and demonstration of the test bench, see Amazon Verified Permissions - Policy Creation and Testing (Primer Series #3) on the AWS YouTube channel. Visual mode Note You must have a schema defined in your policy store to use the Visual mode of the test bench. To test policies in Visual mode 1. Open the Verified Permissions console. Choose your policy store. 2. In the navigation pane on the left, choose Test bench. 3. Choose Visual mode. Testing policies 67 Amazon Verified Permissions User Guide 4. 5. 6. 7. 8. 9. In the Principal section, choose the Principal taking action from the principal types in your schema. Type an identifier for the principal in the text box. (Optional) Choose Add a parent to add parent entities for the specified principal. To remove a parent that has been added to the principal, choose Remove next to the name of the parent. Specify the Attribute value for each attribute of the specified principal. The test bench uses the specified attribute values in the simulated authorization request. In the Resource section, choose the Resource that principal is acting on. Type an identifier for the resource in the text box. (Optional) Choose Add a parent to add parent entities for the specified resource. To remove a parent |
amazon-verified-permissions-user-guide-025 | amazon-verified-permissions-user-guide.pdf | 25 | in the text box. (Optional) Choose Add a parent to add parent entities for the specified principal. To remove a parent that has been added to the principal, choose Remove next to the name of the parent. Specify the Attribute value for each attribute of the specified principal. The test bench uses the specified attribute values in the simulated authorization request. In the Resource section, choose the Resource that principal is acting on. Type an identifier for the resource in the text box. (Optional) Choose Add a parent to add parent entities for the specified resource. To remove a parent that has been added to the resource, choose Remove next to the name of the parent. Specify the Attribute value for each attribute of the specified resource. The test bench uses the specified attribute values in the simulated authorization request. 10. In the Action section, choose the Action that principal is taking from the list of valid actions for the specified principal and resource. 11. Specify the Attribute value for each attribute of the specified action. The test bench uses the specified attribute values in the simulated authorization request. 12. (Optional) In the Additional entities section, choose Add entity to add entities to be evaluated for the authorization decision. 13. Choose the Entity Identifier from the dropdown list and type the entity identifier. 14. (Optional) Choose Add a parent to add parent entities for the specified entity. To remove a parent that has been added to the entity, choose Remove next to the name of the parent. 15. Specify the Attribute value for each attribute of the specified entity. The test bench uses the specified attribute values in the simulated authorization request. 16. Choose Confirm to add the entity to the test bench. 17. Choose Run authorization request to simulate the authorization request for the Cedar policies in your policy store. The test bench displays the decision to allow or deny the request along with information about the policies satisfied or the errors encountered during evaluation. Testing policies 68 Amazon Verified Permissions JSON mode To test policies in JSON mode User Guide 1. Open the Verified Permissions console. Choose your policy store. 2. In the navigation pane on the left, choose Test bench. 3. Choose JSON mode. 4. 5. 6. 7. 8. In the Request details section, if you have a schema defined, choose the Principal taking action from the principal types in your schema. Type an identifier for the principal in the text box. If you do not have a schema defined, type the principal in the Principal taking action text box. If you have a schema defined, choose the Resource from the resource types in your schema. Type an identifier for the resource in the text box. If you do not have a schema defined, type the resource in the Resource text box. If you have a schema defined, choose the Action from the list of valid actions for the specified principal and resource. If you do not have a schema defined, type the action in the Action text box. Enter the context of the request to simulate in the Context field. The request context is additional information that can be used for authorization decisions. In the Entities field, enter the hierarchy of the entities and their attributes to be evaluated for the authorization decision. 9. Choose Run authorization request to simulate the authorization request for the Cedar policies in your policy store. The test bench displays the decision to allow or deny the request along with information about the policies satisfied or the errors encountered during evaluation. Amazon Verified Permissions example policies Some of the policy examples included here are basic Cedar policy examples and some are Verified Permissions-specific. The basic ones link to the Cedar policy language Reference Guide and are included there. For more information about Cedar policy syntax, see Basic policy construction in Cedar in the Cedar policy language Reference Guide. Example policies 69 User Guide Amazon Verified Permissions Policy examples • Allows access to individual entities • Allows access to groups of entities • Allows access for any entity • Allows access for attributes of an entity (ABAC) • Denies access • Uses bracket notation to reference token attributes • Uses dot notation to reference attributes • Reflects Amazon Cognito ID token attributes • Reflects OIDC ID token attributes • Reflects Amazon Cognito access token attributes • Reflects OIDC access token attributes Uses bracket notation to reference token attributes This following example shows how you might create a policy that uses bracket notation to reference token attributes. For more information about using token attributes in policies in Verified Permissions, see Mapping identity provider tokens to schema. permit ( principal in MyCorp::UserGroup::"us-west-2_EXAMPLE|MyUserGroup", action, resource ) when { principal["cognito:username"] == "alice" && principal["custom:employmentStoreCode"] == "petstore-dallas" |
amazon-verified-permissions-user-guide-026 | amazon-verified-permissions-user-guide.pdf | 26 | bracket notation to reference token attributes • Uses dot notation to reference attributes • Reflects Amazon Cognito ID token attributes • Reflects OIDC ID token attributes • Reflects Amazon Cognito access token attributes • Reflects OIDC access token attributes Uses bracket notation to reference token attributes This following example shows how you might create a policy that uses bracket notation to reference token attributes. For more information about using token attributes in policies in Verified Permissions, see Mapping identity provider tokens to schema. permit ( principal in MyCorp::UserGroup::"us-west-2_EXAMPLE|MyUserGroup", action, resource ) when { principal["cognito:username"] == "alice" && principal["custom:employmentStoreCode"] == "petstore-dallas" && principal has email && principal.email == "alice@example.com" && context["ip-address"] like "192.0.2.*" }; Uses dot notation to reference attributes This following example shows how you might create a policy that uses dot notation to reference attributes. Uses bracket notation to reference token attributes 70 Amazon Verified Permissions User Guide For more information about using token attributes in policies in Verified Permissions, see Mapping identity provider tokens to schema. permit(principal, action, resource) when { principal.cognito.username == "alice" && principal.custom.employmentStoreCode == "petstore-dallas" && principal.tenant == "x11app-tenant-1" && principal has email && principal.email == "alice@example.com" }; Reflects Amazon Cognito ID token attributes This following example shows how you might create a policy references ID token attributes from Amazon Cognito. For more information about using token attributes in policies in Verified Permissions, see Mapping identity provider tokens to schema. permit ( principal in MyCorp::UserGroup::"us-west-2_EXAMPLE|MyUserGroup", action, resource ) when { principal["cognito:username"] == "alice" && principal["custom:employmentStoreCode"] == "petstore-dallas" && principal.tenant == "x11app-tenant-1" && principal has email && principal.email == "alice@example.com" }; Reflects OIDC ID token attributes This following example shows how you might create a policy references ID token attributes from an OIDC provider. For more information about using token attributes in policies in Verified Permissions, see Mapping identity provider tokens to schema. permit ( principal in MyCorp::UserGroup::"MyOIDCProvider|MyUserGroup", action, Reflects Amazon Cognito ID token attributes 71 Amazon Verified Permissions resource User Guide ) when { principal.email_verified == true && principal.email == "alice@example.com" && principal.phone_number_verified == true && principal.phone_number like "+1206*" }; Reflects Amazon Cognito access token attributes This following example shows how you might create a policy references access token attributes from Amazon Cognito. For more information about using token attributes in policies in Verified Permissions, see Mapping identity provider tokens to schema. permit(principal, action in [MyApplication::Action::"Read", MyApplication::Action::"GetStoreInventory"], resource) when { context.token.client_id == "52n97d5afhfiu1c4di1k5m8f60" && context.token.scope.contains("MyAPI/mydata.write") }; Reflects OIDC access token attributes This following example shows how you might create a policy references access token attributes from an OIDC provider. For more information about using token attributes in policies in Verified Permissions, see Mapping identity provider tokens to schema. permit( principal, action in [MyApplication::Action::"Read", MyApplication::Action::"GetStoreInventory"], resource ) when { context.token.client_id == "52n97d5afhfiu1c4di1k5m8f60" && context.token.scope.contains("MyAPI-read") }; Reflects Amazon Cognito access token attributes 72 Amazon Verified Permissions User Guide Amazon Verified Permissions policy templates and template-linked policies In Verified Permissions, policy templates are policies with placeholders for the principal, resource, or both. Policy templates alone can't be used to handle authorization requests. To handle authorization requests, a template-linked policy must be created based on a policy template. Policy templates allow a policy to be defined once and then used with multiple principals and resources. Updates to the policy template are reflected across all policies that use the template. For more information, see Cedar policy templates in the Cedar policy language Reference Guide. For example, the following policy template provides Read, Edit, and Comment permissions for the principal and resource that use the policy template. permit( principal == ?principal, action in [Action::"Read", Action::"Edit", Action::"Comment"], resource == ?resource ); If you were to create a policy named Editor based on this template, when a principal is designated as an editor for a specific resource, your application would create a policy that provides permissions for the principal to read, edit, and comment on the resource. Unlike static policies, template-linked policies are dynamic. Take the previous example, if you were to remove the Comment action from the policy template, any policy linked to, or based on, that template would be updated accordingly and the principals specified in the policies would no longer be able to comment on the corresponding resources. For more template-linked policy examples, see Amazon Verified Permissions example template- linked policies. Creating Amazon Verified Permissions policy templates You can create policy templates in Verified Permissions using the AWS Management Console, the AWS CLI, or the AWS SDKs. Policy templates allow a policy to be defined once and then used Creating policy templates 73 Amazon Verified Permissions User Guide with multiple principals and resources. Once you create a policy template you can then create template-linked policies to use the policy templates with specific principals and resources. For more information, see Creating Amazon Verified Permissions template-linked policies. AWS Management Console To create |
amazon-verified-permissions-user-guide-027 | amazon-verified-permissions-user-guide.pdf | 27 | template-linked policy examples, see Amazon Verified Permissions example template- linked policies. Creating Amazon Verified Permissions policy templates You can create policy templates in Verified Permissions using the AWS Management Console, the AWS CLI, or the AWS SDKs. Policy templates allow a policy to be defined once and then used Creating policy templates 73 Amazon Verified Permissions User Guide with multiple principals and resources. Once you create a policy template you can then create template-linked policies to use the policy templates with specific principals and resources. For more information, see Creating Amazon Verified Permissions template-linked policies. AWS Management Console To create a policy template 1. Open the Verified Permissions console. Choose your policy store. 2. In the navigation pane on the left, choose Policy templates. 3. Choose Create policy template. 4. 5. In the Details section, type a Policy template description. In the Policy template body section, use placeholders ?principal and ?resource to allow policies created based on this template to customize permissions they grant. You can choose Format to format the syntax of your policy template with the recommended spacing and indentation. 6. Choose Create policy template. AWS CLI To create a policy template You can create a policy template by using the CreatePolicyTemplate operation. The following example creates a policy template with a placeholder for the principal. The file template1.txt contains the following. "VacationAccess" permit( principal in ?principal, action == Action::"view", resource == Photo::"VacationPhoto94.jpg" ); $ aws verifiedpermissions create-policy-template \ --description "Template for vacation picture access" --statement file://template1.txt --policy-store-id PSEXAMPLEabcdefg111111 Creating policy templates 74 Amazon Verified Permissions { "createdDate": "2023-05-18T21:17:47.284268+00:00", "lastUpdatedDate": "2023-05-18T21:17:47.284268+00:00", "policyStoreId": "PSEXAMPLEabcdefg111111", "policyTemplateId": "PTEXAMPLEabcdefg111111" } User Guide Creating Amazon Verified Permissions template-linked policies You can create template-linked policies, or policies that are based on a policy template, using the AWS Management Console, AWS CLI, or the AWS SDKs. Template-linked policies stay linked to their policy templates. If you change the policy statement in the policy template, any policies linked to that template automatically use the new statement for all authorization decisions made from that moment forward. For template-linked policy examples, see Amazon Verified Permissions example template-linked policies. AWS Management Console To create a template-linked policy by instantiating a policy template 1. Open the Verified Permissions console. Choose your policy store. 2. In the navigation pane on the left, choose Policies. 3. Choose Create policy and then choose Create template-linked policy. 4. Choose the radio button next to the policy template to use and then choose Next. 5. Type the Principal and Resource to be used for this specific instance of the template-linked policy. The specified values are displayed in the Policy statement preview field. Note The Principal and Resource values must have the same formatting as static policies. For example, to specify the AdminUsers group for the principal, type Group::"AdminUsers". If you type AdminUsers, a validation error is displayed. 6. Choose Create template-linked policy. The new template-linked policy is displayed under Policies. Creating template-linked policies 75 Amazon Verified Permissions AWS CLI User Guide To create a template-linked policy by instantiating a policy template You can create a template-linked policy that references an existing policy template and that specifies values for any placeholders used by the template. The following example creates a template-linked policy that uses a template with the following statement: permit( principal in ?principal, action == PhotoFlash::Action::"view", resource == PhotoFlash::Photo::"VacationPhoto94.jpg" ); It also uses the following definition.txt file to supply the value for the definition parameter: { "templateLinked": { "policyTemplateId": "PTEXAMPLEabcdefg111111", "principal": { "entityType": "PhotoFlash::User", "entityId": "alice" } } } The output shows both the resource, which it gets from the template, and the principal, which it gets from the definition parameter $ aws verifiedpermissions create-policy \ --definition file://definition.txt --policy-store-id PSEXAMPLEabcdefg111111 { "createdDate": "2023-05-22T18:57:53.298278+00:00", "lastUpdatedDate": "2023-05-22T18:57:53.298278+00:00", "policyId": "TPEXAMPLEabcdefg111111", "policyStoreId": "PSEXAMPLEabcdefg111111", "policyType": "TEMPLATELINKED", Creating template-linked policies 76 Amazon Verified Permissions "principal": { "entityId": "alice", "entityType": "PhotoFlash::User" }, "resource": { "entityId": "VacationPhoto94.jpg", "entityType": "PhotoFlash::Photo" } } User Guide Editing Amazon Verified Permissions policy templates You can edit, or update, policy templates in Verified Permissions using the AWS Management Console, the AWS CLI, or the AWS SDKs. Editing a policy template will automatically update the policies that are linked to, or based on, the template so take care when editing the policy templates and make sure you don’t accidentally introduce a change that breaks your application. You can change the following elements of a policy template: • The action referenced by the policy template • A condition clause, such as when and unless You can't change the following elements of a policy template. To change any of these elements you will need to delete and re-created the policy template. • The effect of a policy template from permit or forbid • The principal referenced by a policy template • The resource referenced by a policy template AWS Management Console |
amazon-verified-permissions-user-guide-028 | amazon-verified-permissions-user-guide.pdf | 28 | editing the policy templates and make sure you don’t accidentally introduce a change that breaks your application. You can change the following elements of a policy template: • The action referenced by the policy template • A condition clause, such as when and unless You can't change the following elements of a policy template. To change any of these elements you will need to delete and re-created the policy template. • The effect of a policy template from permit or forbid • The principal referenced by a policy template • The resource referenced by a policy template AWS Management Console To edit your policy templates 1. Open the Verified Permissions console. Choose your policy store. 2. In the navigation pane on the left, choose Policy templates. The console displays all of the policy templates you created in the current policy store. Editing policy templates 77 Amazon Verified Permissions User Guide 3. Choose the radio button next to a policy template to display details about the policy template, such as when the policy template was created, updated, and the policy template contents. 4. Choose Edit to edit your policy template. Update the Policy description and Policy body as necessary and then choose Update policy template. 5. You can delete a policy template by choosing the radio button next to a policy template and then choosing Delete. Choose OK to confirm deleting the policy template. AWS CLI To edit a policy template You can create a static policy by using the UpdatePolicy operation. The following example updates the specified policy template by replacing its policy body with a new policy defined in a file. Contents of file template1.txt: permit( principal in ?principal, action == Action::"view", resource in ?resource) when { principal has department && principal.department == "research" }; $ aws verifiedpermissions update-policy-template \ --policy-template-id PTEXAMPLEabcdefg111111 \ --description "My updated template description" \ --statement file://template1.txt \ --policy-store-id PSEXAMPLEabcdefg111111 { "createdDate": "2023-05-17T18:58:48.795411+00:00", "lastUpdatedDate": "2023-05-17T19:18:48.870209+00:00", "policyStoreId": "PSEXAMPLEabcdefg111111", "policyTemplateId": "PTEXAMPLEabcdefg111111" } Editing policy templates 78 Amazon Verified Permissions User Guide Amazon Verified Permissions example template-linked policies When you create a policy store in Verified Permissions using the Sample policy store method, your policy store is created with predefined policies, policy templates, and a schema for the sample project you chose. The following Verified Permissions template-linked policy examples can be used with the sample policy stores and their respective policies, policy templates, and schemas. PhotoFlash examples The following example shows how you might create a template-linked policy that uses the policy template Grant limited access to non-private shared photos with an individual user and photo. Note Cedar policy language considers an entity to be in itself. Therefore, principal in User::"Alice" is equivalent to principal == User::"Alice". permit ( principal in PhotoFlash::User::"Alice", action in PhotoFlash::Action::"SharePhotoLimitedAccess", resource in PhotoFlash::Photo::"VacationPhoto94.jpg" ); The following example shows how you might create a template-linked policy that uses the policy template Grant limited access to non-private shared photos with an individual user and album. permit ( principal in PhotoFlash::User::"Alice", action in PhotoFlash::Action::"SharePhotoLimitedAccess", resource in PhotoFlash::Album::"Italy2023" ); The following example shows how you might create a template-linked policy that uses the policy template Grant limited access to non-private shared photos with a friend group and individual photo. permit ( Example template-linked policies 79 Amazon Verified Permissions User Guide principal in PhotoFlash::FriendGroup::"Jane::MySchoolFriends", action in PhotoFlash::Action::"SharePhotoLimitedAccess", resource in PhotoFlash::Photo::"VacationPhoto94.jpg" ); The following example shows how you might create a template-linked policy that uses the policy template Grant limited access to non-private shared photos with a friend group and album. permit ( principal in PhotoFlash::FriendGroup::"Jane::MySchoolFriends", action in PhotoFlash::Action::"SharePhotoLimitedAccess", resource in PhotoFlash::Album::"Italy2023" ); The following example shows how you might create a template-linked policy that uses the policy template Grant full access to non-private shared photos with a friend group and an individual photo. permit ( principal in PhotoFlash::UserGroup::"Jane::MySchoolFriends", action in PhotoFlash::Action::"SharePhotoFullAccess", resource in PhotoFlash::Photo::"VacationPhoto94.jpg" ); The following example shows how you might create a template-linked policy that uses the policy template Block user from an account. forbid( principal == PhotoFlash::User::"Bob", action, resource in PhotoFlash::Account::"Alice-account" ); DigitalPetStore examples The DigitalPetStore sample policy store does not include any policy templates. You can view the policies included with the policy store by choosing Policies in the navigation pane on the left after creating the DigitalPetStore sample policy store. DigitalPetStore examples 80 Amazon Verified Permissions TinyToDo examples User Guide The following example shows how you might create a template-linked policy that uses the policy template that gives viewer access for an individual user and task list. permit ( principal == TinyTodo::User::"https://cognito-idp.us-east-1.amazonaws.com/us- east-1_h2aKCU1ts|5ae0c4b1-6de8-4dff-b52e-158188686f31|bob", action in [TinyTodo::Action::"ReadList", TinyTodo::Action::"ListTasks"], resource == TinyTodo::List::"1" ); The following example shows how you might create a template-linked policy that uses the policy template that gives editor access for an individual user and task list. permit ( principal == TinyTodo::User::"https://cognito-idp.us-east-1.amazonaws.com/us- east-1_h2aKCU1ts|5ae0c4b1-6de8-4dff-b52e-158188686f31|bob", action in [ TinyTodo::Action::"ReadList", TinyTodo::Action::"UpdateList", TinyTodo::Action::"ListTasks", TinyTodo::Action::"CreateTask", TinyTodo::Action::"UpdateTask", TinyTodo::Action::"DeleteTask" |
amazon-verified-permissions-user-guide-029 | amazon-verified-permissions-user-guide.pdf | 29 | after creating the DigitalPetStore sample policy store. DigitalPetStore examples 80 Amazon Verified Permissions TinyToDo examples User Guide The following example shows how you might create a template-linked policy that uses the policy template that gives viewer access for an individual user and task list. permit ( principal == TinyTodo::User::"https://cognito-idp.us-east-1.amazonaws.com/us- east-1_h2aKCU1ts|5ae0c4b1-6de8-4dff-b52e-158188686f31|bob", action in [TinyTodo::Action::"ReadList", TinyTodo::Action::"ListTasks"], resource == TinyTodo::List::"1" ); The following example shows how you might create a template-linked policy that uses the policy template that gives editor access for an individual user and task list. permit ( principal == TinyTodo::User::"https://cognito-idp.us-east-1.amazonaws.com/us- east-1_h2aKCU1ts|5ae0c4b1-6de8-4dff-b52e-158188686f31|bob", action in [ TinyTodo::Action::"ReadList", TinyTodo::Action::"UpdateList", TinyTodo::Action::"ListTasks", TinyTodo::Action::"CreateTask", TinyTodo::Action::"UpdateTask", TinyTodo::Action::"DeleteTask" ], resource == TinyTodo::List::"1" ); TinyToDo examples 81 Amazon Verified Permissions User Guide Using Amazon Verified Permissions with identity providers An identity source is a representation of an external identity provider (IdP) in Amazon Verified Permissions. Identity sources provide information from a user who authenticated with an IdP that has a trust relationship with your policy store. When your application makes an authorization request with a token from an identity source, your policy store can make authorization decisions from user properties and access permissions. You can add an Amazon Cognito user pool or a custom OpenID Connect (OIDC) IdP as your identity source. You can use OpenID Connect (OIDC) identity providers (IdPs) with Verified Permissions. Your application can generate authorization requests with JSON web tokens (JWTs) generated by an OIDC-compliant identity provider. The user identity in the token is mapped to the principal ID. With ID tokens, Verified Permissions maps attribute claims to principal attributes. With Access tokens, these claims are mapped to context. With both token types, you can map a claim like groups to a principal group, and build policies that evaluate role-based access control (RBAC). Note Verified Permissions makes authorization decisions based on information from an IdP token but doesn't interact directly with the IdP in any way. For a step-by-step walkthrough that builds authorization logic for Amazon API Gateway REST APIs using an Amazon Cognito user pool or OIDC identity provider, see Authorize API Gateway APIs using Amazon Verified Permissions with Amazon Cognito or bring your own identity provider on the AWS Security Blog. Topics • Working with Amazon Cognito identity sources • Working with OIDC identity sources • Client and audience validation • Client-side authorization for JWTs • Creating Amazon Verified Permissions identity sources • Editing Amazon Verified Permissions identity sources 82 Amazon Verified Permissions User Guide • Mapping identity provider tokens to schema Working with Amazon Cognito identity sources Verified Permissions works closely with Amazon Cognito user pools. Amazon Cognito JWTs have a predictable structure. Verified Permissions recognizes this structure and draws maximum benefit from the information that it contains. For example, you can implement a role-based access control (RBAC) authorization model with either ID tokens or access tokens. A new Amazon Cognito user pools identity source requires the following information: • The AWS Region. • The user pool ID. • The principal entity type that you want to associate with your identity source, for example MyCorp::User. • The principal group entity type that you want to associate with your identity source, for example MyCorp::UserGroup. • The client IDs from your user pool that you want to authorize to make requests to your policy store. Because Verified Permissions only works with Amazon Cognito user pools in the same AWS account, you can't specify an identity source in another account. Verified Permissions sets the entity prefix—the identity-source identifier that you must reference in policies that act on user pool principals—to the ID of your user pool, for example us-west-2_EXAMPLE. In this case, you would reference a user in that user pool with ID a1b2c3d4-5678-90ab-cdef-EXAMPLE22222 as us- west-2_EXAMPLE|a1b2c3d4-5678-90ab-cdef-EXAMPLE22222 User pool token claims can contain attributes, scopes, groups, client IDs, and custom data. Amazon Cognito JWTs have the ability to include a variety of information that can contribute to authorization decisions in Verified Permissions. These include: 1. Username and group claims with a cognito: prefix 2. Custom user attributes with a custom: prefix 3. Custom claims added at runtime 4. OIDC standard claims like sub and email Working with Amazon Cognito identity sources 83 Amazon Verified Permissions User Guide We cover these claims in detail, and how to manage them in Verified Permissions policies, in Mapping identity provider tokens to schema. Important Although you can revoke Amazon Cognito tokens before they expire, JWTs are considered to be stateless resources that are self-contained with a signature and validity. Services that conform with the JSON Web Token RFC 7519 are expected to validate tokens remotely and aren't required to validate them with the issuer. This means that it is possible for Verified Permissions to grant access based on a token that was revoked or issued for a user that was later deleted. To mitigate this risk, we recommend that |
amazon-verified-permissions-user-guide-030 | amazon-verified-permissions-user-guide.pdf | 30 | to manage them in Verified Permissions policies, in Mapping identity provider tokens to schema. Important Although you can revoke Amazon Cognito tokens before they expire, JWTs are considered to be stateless resources that are self-contained with a signature and validity. Services that conform with the JSON Web Token RFC 7519 are expected to validate tokens remotely and aren't required to validate them with the issuer. This means that it is possible for Verified Permissions to grant access based on a token that was revoked or issued for a user that was later deleted. To mitigate this risk, we recommend that you create your tokens with the shortest possible validity duration and revoke refresh tokens when you want to remove authorization to continue a user's session. For more information, see Ending user sessions with token revocation This following example shows how you might create a policy that references some of the Amazon Cognito user pools claims associated with a principal. permit( principal, action, resource == ExampleCo::Photo::"VacationPhoto94.jpg" ) when { principal["cognito:username"]) == "alice" && principal["custom:department"]) == "Finance" }; This following example shows how you might create a policy that references a principal that's a user in a Cognito user pool. Note that the principal ID takes the form of "<userpool-id>| <sub>". permit( principal == ExampleCo::User::"us-east-1_example|a1b2c3d4-5678-90ab-cdef- EXAMPLE11111", action, resource == ExampleCo::Photo::"VacationPhoto94.jpg" ); Working with Amazon Cognito identity sources 84 Amazon Verified Permissions User Guide Cedar policies for user pool identity sources in Verified Permissions use a special syntax for claim names that contain characters other than alphanumeric and underscore (_). This includes user pool prefix claims that contain a : character, like cognito:username and custom:department. To write a policy condition that references the cognito:username or custom:department claim, write them as principal["cognito:username"] and principal["custom:department"], respectively. Note If a token contains a claim with a cognito: or custom: prefix and a claim name with the literal value cognito or custom, an authorization request with IsAuthorizedWithToken will fail with a ValidationException. For more information about mapping claims, see Mapping ID tokens to schema. For more information about authorization for Amazon Cognito users, see Authorization with Amazon Verified Permissions in the Amazon Cognito Developer Guide. Working with OIDC identity sources You can also configure any compliant OpenID Connect (OIDC) IdP as the identity source of a policy store. OIDC providers are similar to Amazon Cognito user pools: they produce JWTs as the product of authentication. To add an OIDC provider, you must provide an issuer URL A new OIDC identity source requires the following information: • The issuer URL. Verified Permissions must be able to discover a .well-known/openid- configuration endpoint at this URL. • CNAME records that don't include wild cards. For example, a.example.com can't be mapped to *.example.net. Conversely, *.example.com can't be mapped to a.example.net. • The token type that you want to use in authorization requests. In this case, you chose Identity token. • The user entity type that you want to associate with your identity source, for example MyCorp::User. • The group entity type that you want to associate with your identity source, for example MyCorp::UserGroup. • An example ID token, or a definition of the claims in the ID token. Working with OIDC identity sources 85 Amazon Verified Permissions User Guide • The prefix that you want to apply to user and group entity IDs. In the CLI and API, you can choose this prefix. In policy stores that you create with the Set up with API Gateway and an identity provider or Guided setup option, Verified Permissions assigns a prefix of the issuer name minus https://, for example MyCorp::User::"auth.example.com| a1b2c3d4-5678-90ab-cdef-EXAMPLE11111". For more information about using API operations to authorize requests from OIDC sources, see Available API operations for authorization. This following example shows how you might create a policy that permits access to year-end reports for employees in the accounting department, have a confidential classification, and aren't in a satellite office. Verified Permissions derives these attributes from the claims in the principal's ID token. Note that when referencing a group in the principal, you must use the in operator for the policy to be evaluated correctly. permit( principal in MyCorp::UserGroup::"MyOIDCProvider|Accounting", action, resource in MyCorp::Folder::"YearEnd2024" ) when { principal.jobClassification == "Confidential" && !(principal.location like "SatelliteOffice*") }; Client and audience validation When you add an identity source to a policy store, Verified Permissions has configuration options that verify that ID and access tokens are being used as intended. This validation happens in the processing of IsAuthorizedWithToken and BatchIsAuthorizedWithToken API requests. The behavior differs between ID and access tokens, and between Amazon Cognito and OIDC identity sources. With Amazon Cognito user pools providers, Verified Permissions can validate the client ID in both ID and access tokens. With OIDC providers, Verified Permissions can validate the client ID in ID tokens, and the audience in access tokens. |
amazon-verified-permissions-user-guide-031 | amazon-verified-permissions-user-guide.pdf | 31 | like "SatelliteOffice*") }; Client and audience validation When you add an identity source to a policy store, Verified Permissions has configuration options that verify that ID and access tokens are being used as intended. This validation happens in the processing of IsAuthorizedWithToken and BatchIsAuthorizedWithToken API requests. The behavior differs between ID and access tokens, and between Amazon Cognito and OIDC identity sources. With Amazon Cognito user pools providers, Verified Permissions can validate the client ID in both ID and access tokens. With OIDC providers, Verified Permissions can validate the client ID in ID tokens, and the audience in access tokens. A client ID is an identifier associated with the identity provider instance that your application uses, for example 1example23456789. An audience is a URL path associated with the intended relying Client and audience validation 86 Amazon Verified Permissions User Guide party, or destination, of the access token, for example https://mytoken.example.com. When using access tokens, the aud claim is always associated with the audience. Verified Permissions performs identity source audience and client validation as follows: Amazon Cognito Amazon Cognito ID tokens have an aud claim that contains the app client ID. Access tokens have a client_id claim that also contains the app client ID. When you enter one or more values for Client application validation in your identity source, Verified Permissions compares this list of app client IDs to the ID token aud claim or the access token client_id claim. Verified Permissions doesn't validate a relying-party audience URL for Amazon Cognito identity sources. OIDC OIDC ID tokens have an aud claim that contains client IDs, such as 1example23456789. OIDC Access tokens have an aud claim that contains the audience URL for the token, such as https://myapplication.example.com, and a client_id claim that contains client IDs, such as 1example23456789. When setting up your policy store, enter one or more values for Audience validation that your policy store with use to validate the audience of a token. • ID tokens – Verified Permissions validates the client ID by checking that at least one member of the client IDs in the aud claim matches an audience validation value. • Access tokens – Verified Permissions validates the audience by checking that the URL in the aud claim matches an audience validation value. If no aud claim exists, the audience can be validated using the cid or client_id claims. Check with your identity provider for the correct audience claim and format. Client-side authorization for JWTs You might want to process JSON web tokens in your application and pass their claims to Verified Permissions without using a policy store identity source. You can extract your entity attributes from a JSON Web Token (JWT) and parse it into Verified Permissions. This example shows how you might call Verified Permissions from an application using a JWT.¹ Client-side authorization for JWTs 87 Amazon Verified Permissions User Guide async function authorizeUsingJwtToken(jwtToken) { const payload = await verifier.verify(jwtToken); let principalEntity = { entityType: "PhotoFlash::User", // the application needs to fill in the relevant user type entityId: payload["sub"], // the application need to use the claim that represents the user-id }; let resourceEntity = { entityType: "PhotoFlash::Photo", //the application needs to fill in the relevant resource type entityId: "jane_photo_123.jpg", // the application needs to fill in the relevant resource id }; let action = { actionType: "PhotoFlash::Action", //the application needs to fill in the relevant action id actionId: "GetPhoto", //the application needs to fill in the relevant action type }; let entities = { entityList: [], }; entities.entityList.push(...getUserEntitiesFromToken(payload)); let policyStoreId = "PSEXAMPLEabcdefg111111"; // set your own policy store id const authResult = await client .isAuthorized({ policyStoreId: policyStoreId, principal: principalEntity, resource: resourceEntity, action: action, entities, }) .promise(); return authResult; } function getUserEntitiesFromToken(payload) { Client-side authorization for JWTs 88 Amazon Verified Permissions let attributes = {}; let claimsNotPassedInEntities = ['aud', 'sub', 'exp', 'jti', 'iss']; Object.entries(payload).forEach(([key, value]) => { if (claimsNotPassedInEntities.includes(key)) { User Guide return; } if (Array.isArray(value)) { var attibuteItem = []; value.forEach((item) => { attibuteItem.push({ string: item, }); }); attributes[key] = { set: attibuteItem, }; } else if (typeof value === 'string') { attributes[key] = { string: value, } } else if (typeof value === 'bigint' || typeof value ==='number') { attributes[key] = { long: value, } } else if (typeof value === 'boolean') { attributes[key] = { boolean: value, } } }); let entityItem = { attributes: attributes, identifier: { entityType: "PhotoFlash::User", entityId: payload["sub"], // the application needs to use the claim that represents the user-id } }; return [entityItem]; } Client-side authorization for JWTs 89 Amazon Verified Permissions User Guide ¹ This code example uses the aws-jwt-verify library for verifying JWTs signed by OIDC-compatible IdPs. Creating Amazon Verified Permissions identity sources The following procedure adds an identity source to an existing policy store. After you add your identity source, you must add attributes |
amazon-verified-permissions-user-guide-032 | amazon-verified-permissions-user-guide.pdf | 32 | value, } } else if (typeof value === 'boolean') { attributes[key] = { boolean: value, } } }); let entityItem = { attributes: attributes, identifier: { entityType: "PhotoFlash::User", entityId: payload["sub"], // the application needs to use the claim that represents the user-id } }; return [entityItem]; } Client-side authorization for JWTs 89 Amazon Verified Permissions User Guide ¹ This code example uses the aws-jwt-verify library for verifying JWTs signed by OIDC-compatible IdPs. Creating Amazon Verified Permissions identity sources The following procedure adds an identity source to an existing policy store. After you add your identity source, you must add attributes to your schema. You can also create an identity source when you create a new policy store in the Verified Permissions console. In this process, you can automatically import the claims in your identity source tokens into entity attributes. Choose the Guided setup or Set up with API Gateway and an identity provider option. These options also create initial policies. Note Identity sources is not available in the navigation pane on the left until you have created a policy store. Identity sources that you create are associated with the current policy store. You can leave out the principal entity type when you create an identity source with create-identity- source in the AWS CLI or CreateIdentitySource in the Verified Permissions API. However, a blank entity type creates an identity source with an entity type of AWS::Cognito. This entity name isn't compatible with policy store schema. To integrate Amazon Cognito identities with your policy store schema, you must set the principal entity type to a supported policy store entity. Topics • Amazon Cognito identity source • OIDC identity source Amazon Cognito identity source AWS Management Console To create an Amazon Cognito user pools identity source 1. Open the Verified Permissions console. Choose your policy store. 2. In the navigation pane on the left, choose Identity sources. Creating identity sources 90 Amazon Verified Permissions User Guide 3. Choose Create identity source. 4. 5. 6. In Cognito user pool details, select the AWS Region and enter the User pool ID for your identity source. In Principal configuration, for Principal type, choose the entity type for principals from this source. Identities from the connected Amazon Cognito user pools will be mapped to the selected principal type. In Group configuration, select Use Cognito group if you want to map the user pool cognito:groups claim. Choose an entity type that is a parent of the principal type. 7. In Client application validation, choose whether to validate client application IDs. • To validate client application IDs, choose Only accept tokens with matching client application IDs. Choose Add new client application ID for each client application ID to validate. To remove a client application ID that has been added, choose Remove next to the client application ID. • Choose Do not validate client application IDs if you do not want to validate client application IDs. 8. Choose Create identity source. If your policy store has a schema, before you can reference attributes you extract from identity or access tokens in your Cedar policies, you must update your schema to make Cedar aware of the type of principal that your identity source creates. That addition to the schema must include the attributes that you want to reference in your Cedar policies. For more information about mapping Amazon Cognito token attributes to Cedar principal attributes, see Mapping identity provider tokens to schema. When you create an API-linked policy store or use Set up with API Gateway and an identity provider when creating policy stores, Verified Permissions queries your user pool for user attributes and creates a schema where your principal type is populated with user pool attributes. AWS CLI To create an Amazon Cognito user pools identity source You can an create an identity source by using the CreateIdentitySource operation. The following example creates an identity source that can access authenticated identities from a Amazon Cognito user pool. Amazon Cognito identity source 91 Amazon Verified Permissions User Guide The following config.txt file contains the details of the Amazon Cognito user pool for use by the --configuration parameter in the create-identity-source command. { "cognitoUserPoolConfiguration": { "userPoolArn": "arn:aws:cognito-idp:us-west-2:123456789012:userpool/us- west-2_1a2b3c4d5", "clientIds":["a1b2c3d4e5f6g7h8i9j0kalbmc"], "groupConfiguration": { "groupEntityType": "MyCorp::UserGroup" } } } Command: $ aws verifiedpermissions create-identity-source \ --configuration file://config.txt \ --principal-entity-type "User" \ --policy-store-id 123456789012 { "createdDate": "2023-05-19T20:30:28.214829+00:00", "identitySourceId": "ISEXAMPLEabcdefg111111", "lastUpdatedDate": "2023-05-19T20:30:28.214829+00:00", "policyStoreId": "PSEXAMPLEabcdefg111111" } If your policy store has a schema, before you can reference attributes you extract from identity or access tokens in your Cedar policies, you must update your schema to make Cedar aware of the type of principal that your identity source creates. That addition to the schema must include the attributes that you want to reference in your Cedar policies. For more information about mapping Amazon Cognito token attributes to Cedar principal |
amazon-verified-permissions-user-guide-033 | amazon-verified-permissions-user-guide.pdf | 33 | "MyCorp::UserGroup" } } } Command: $ aws verifiedpermissions create-identity-source \ --configuration file://config.txt \ --principal-entity-type "User" \ --policy-store-id 123456789012 { "createdDate": "2023-05-19T20:30:28.214829+00:00", "identitySourceId": "ISEXAMPLEabcdefg111111", "lastUpdatedDate": "2023-05-19T20:30:28.214829+00:00", "policyStoreId": "PSEXAMPLEabcdefg111111" } If your policy store has a schema, before you can reference attributes you extract from identity or access tokens in your Cedar policies, you must update your schema to make Cedar aware of the type of principal that your identity source creates. That addition to the schema must include the attributes that you want to reference in your Cedar policies. For more information about mapping Amazon Cognito token attributes to Cedar principal attributes, see Mapping identity provider tokens to schema. When you create an API-linked policy store or use Set up with API Gateway and an identity provider when creating policy stores, Verified Permissions queries your user pool for user attributes and creates a schema where your principal type is populated with user pool attributes. Amazon Cognito identity source 92 Amazon Verified Permissions User Guide For more information about using Amazon Cognito access and identity tokens for authenticated users in Verified Permissions, see Authorization with Amazon Verified Permissions in the Amazon Cognito Developer Guide. OIDC identity source AWS Management Console To create an OpenID Connect (OIDC) identity source 1. Open the Verified Permissions console. Choose your policy store. 2. In the navigation pane on the left, choose Identity sources. 3. Choose Create identity source. 4. Choose External OIDC provider. 5. In Issuer URL, enter the URL of your OIDC issuer. This is the service endpoint that provides the authorization server, signing keys, and other information about your provider, for example https://auth.example.com. Your issuer URL must host an OIDC discovery document at /.well-known/openid-configuration. 6. 7. In Token type, choose the type of OIDC JWT that you want your application to submit for authorization. For more information, see Mapping identity provider tokens to schema. In Map token claims to schema entities, choose a User entity and User claim for the identity source. The User entity is an entity in your policy store that you want to refer to users from your OIDC provider. The User claim is a claim, typically sub, from your ID or access token that holds the unique identifier for the entity to be evaluated. Identities from the connected OIDC IdP will be mapped to the selected principal type. 8. (Optional) In Map token claims to schema entities, choose a Group entity and Group claim for the identity source. The Group entity is a parent of the User entity. Group claims get mapped to this entity. The Group claim is a claim, typically groups, from your ID or access token that contains a string, JSON, or space-delimited string of user-group names for the entity to be evaluated. Identities from the connected OIDC IdP will be mapped to the selected principal type. 9. In validation - optional, enter the client IDs or audience URLs that you want your policy store to accept in authorization requests, if any. 10. Choose Create identity source. 11. Update your schema to make Cedar aware of the type of principal that your identity source creates. That addition to the schema must include the attributes that you want to OIDC identity source 93 Amazon Verified Permissions User Guide reference in your Cedar policies. For more information about mapping Amazon Cognito token attributes to Cedar principal attributes, see Mapping identity provider tokens to schema. When you create an API-linked policy store, Verified Permissions queries your user pool for user attributes and creates a schema where your principal type is populated with user pool attributes. AWS CLI To create an OIDC identity source You can an create an identity source by using the CreateIdentitySource operation. The following example creates an identity source that can access authenticated identities from a Amazon Cognito user pool. The following config.txt file contains the details of an OIDC IdP for use by the -- configuration parameter of the create-identity-source command. This example creates an OIDC identity source for ID tokens. { "openIdConnectConfiguration": { "issuer": "https://auth.example.com", "tokenSelection": { "identityTokenOnly": { "clientIds":["1example23456789"], "principalIdClaim": "sub" }, }, "entityIdPrefix": "MyOIDCProvider", "groupConfiguration": { "groupClaim": "groups", "groupEntityType": "MyCorp::UserGroup" } } } The following config.txt file contains the details of an OIDC IdP for use by the -- configuration parameter of the create-identity-source command. This example creates an OIDC identity source for access tokens. OIDC identity source 94 Amazon Verified Permissions User Guide { "openIdConnectConfiguration": { "issuer": "https://auth.example.com", "tokenSelection": { "accessTokenOnly": { "audiences":["https://auth.example.com"], "principalIdClaim": "sub" }, }, "entityIdPrefix": "MyOIDCProvider", "groupConfiguration": { "groupClaim": "groups", "groupEntityType": "MyCorp::UserGroup" } } } Command: $ aws verifiedpermissions create-identity-source \ --configuration file://config.txt \ --principal-entity-type "User" \ --policy-store-id 123456789012 { "createdDate": "2023-05-19T20:30:28.214829+00:00", "identitySourceId": "ISEXAMPLEabcdefg111111", "lastUpdatedDate": "2023-05-19T20:30:28.214829+00:00", "policyStoreId": "PSEXAMPLEabcdefg111111" } Before you can reference attributes that you extract from identity or access tokens in your Cedar policies, you must update |
amazon-verified-permissions-user-guide-034 | amazon-verified-permissions-user-guide.pdf | 34 | IdP for use by the -- configuration parameter of the create-identity-source command. This example creates an OIDC identity source for access tokens. OIDC identity source 94 Amazon Verified Permissions User Guide { "openIdConnectConfiguration": { "issuer": "https://auth.example.com", "tokenSelection": { "accessTokenOnly": { "audiences":["https://auth.example.com"], "principalIdClaim": "sub" }, }, "entityIdPrefix": "MyOIDCProvider", "groupConfiguration": { "groupClaim": "groups", "groupEntityType": "MyCorp::UserGroup" } } } Command: $ aws verifiedpermissions create-identity-source \ --configuration file://config.txt \ --principal-entity-type "User" \ --policy-store-id 123456789012 { "createdDate": "2023-05-19T20:30:28.214829+00:00", "identitySourceId": "ISEXAMPLEabcdefg111111", "lastUpdatedDate": "2023-05-19T20:30:28.214829+00:00", "policyStoreId": "PSEXAMPLEabcdefg111111" } Before you can reference attributes that you extract from identity or access tokens in your Cedar policies, you must update your schema to make Cedar aware of the type of principal that your identity source creates. That addition to the schema must include the attributes that you want to reference in your Cedar policies. For more information about mapping Amazon Cognito token attributes to Cedar principal attributes, see Mapping identity provider tokens to schema. When you create an API-linked policy store, Verified Permissions queries your user pool for user attributes and creates a schema where your principal type is populated with user pool attributes. OIDC identity source 95 Amazon Verified Permissions User Guide Editing Amazon Verified Permissions identity sources You can edit some parameters of your identity source after you create it. You can't change the type of identity source, you have to delete the identity source and create a new one to switch from Amazon Cognito to OIDC or OIDC to Amazon Cognito. If your policy store schema matches your identity source attributes, note that you must update your schema separately to reflect the changes that you make to your identity source. Topics • Amazon Cognito user pools identity source • OpenID Connect (OIDC) identity source Amazon Cognito user pools identity source AWS Management Console To update an Amazon Cognito user pools identity source 1. Open the Verified Permissions console. Choose your policy store. 2. In the navigation pane on the left, choose Identity sources. 3. Choose the ID of the identity source to edit. 4. Choose Edit. 5. 6. In Cognito user pool details, select the AWS Region and type the User pool ID for your identity source. In Principal details, you can update the Principal type for the identity source. Identities from the connected Amazon Cognito user pools will be mapped to the selected principal type. 7. In Group configuration, select Use Cognito groups if you want to map the user pool cognito:groups claim. Choose an entity type that is a parent of the principal type. 8. In Client application validation, choose whether to validate client application IDs. • To validate client application IDs, choose Only accept tokens with matching client application IDs. Choose Add new client application ID for each client application ID to validate. To remove a client application ID that has been added, choose Remove next to the client application ID. Editing identity sources 96 Amazon Verified Permissions User Guide • Choose Do not validate client application IDs if you do not want to validate client application IDs. 9. Choose Save changes. 10. If you changed the principal type for the identity source, you must update your schema to correctly reflect the updated principal type. You can delete an identity source by choosing the radio button next to an identity source and then choosing Delete identity source. Type delete in the text box and then choose Delete identity source to confirm deleting the identity source. AWS CLI To update an Amazon Cognito user pools identity source You can update an identity source by using the UpdateIdentitySource operation. The following example updates the specified identity source to use a different Amazon Cognito user pool. The following config.txt file contains the details of the Amazon Cognito user pool for use by the --configuration parameter in the create-identity-source command. { "cognitoUserPoolConfiguration": { "userPoolArn": "arn:aws:cognito-idp:us-west-2:123456789012:userpool/us- west-2_1a2b3c4d5", "clientIds":["a1b2c3d4e5f6g7h8i9j0kalbmc"], "groupConfiguration": { "groupEntityType": "MyCorp::UserGroup" } } } Command: $ aws verifiedpermissions update-identity-source \ --update-configuration file://config.txt \ --policy-store-id 123456789012 { "createdDate": "2023-05-19T20:30:28.214829+00:00", "identitySourceId": "ISEXAMPLEabcdefg111111", "lastUpdatedDate": "2023-05-19T20:30:28.214829+00:00", "policyStoreId": "PSEXAMPLEabcdefg111111" Amazon Cognito user pools identity source 97 Amazon Verified Permissions } User Guide If you change the principal type for the identity source, you must update your schema to correctly reflect the updated principal type. OpenID Connect (OIDC) identity source AWS Management Console To update an OIDC identity source 1. Open the Verified Permissions console. Choose your policy store. 2. In the navigation pane on the left, choose Identity sources. 3. Choose the ID of the identity source to edit. 4. Choose Edit. 5. 6. In OIDC provider details, change the Issuer URL as needed. In Map token claims to schema attributes, change the associations between user and group claims and policy store entity types, as needed. After you change entity types, you must update your policies and schema attributes to apply to the |
amazon-verified-permissions-user-guide-035 | amazon-verified-permissions-user-guide.pdf | 35 | type. OpenID Connect (OIDC) identity source AWS Management Console To update an OIDC identity source 1. Open the Verified Permissions console. Choose your policy store. 2. In the navigation pane on the left, choose Identity sources. 3. Choose the ID of the identity source to edit. 4. Choose Edit. 5. 6. In OIDC provider details, change the Issuer URL as needed. In Map token claims to schema attributes, change the associations between user and group claims and policy store entity types, as needed. After you change entity types, you must update your policies and schema attributes to apply to the new entity types. 7. In Audience validation, add or remove audience values that you want to enforce. 8. Choose Save changes. You can delete an identity source by choosing the radio button next to an identity source and then choosing Delete identity source. Type delete in the text box and then choose Delete identity source to confirm deleting the identity source. AWS CLI To update an OIDC identity source You can update an identity source by using the UpdateIdentitySource operation. The following example updates the specified identity source to use a different OIDC provider. The following config.txt file contains the details of the Amazon Cognito user pool for use by the --configuration parameter in the create-identity-source command. { OpenID Connect (OIDC) identity source 98 Amazon Verified Permissions User Guide "openIdConnectConfiguration": { "issuer": "https://auth2.example.com", "tokenSelection": { "identityTokenOnly": { "clientIds":["2example10111213"], "principalIdClaim": "sub" }, }, "entityIdPrefix": "MyOIDCProvider", "groupConfiguration": { "groupClaim": "groups", "groupEntityType": "MyCorp::UserGroup" } } } Command: $ aws verifiedpermissions update-identity-source \ --update-configuration file://config.txt \ --policy-store-id 123456789012 { "createdDate": "2023-05-19T20:30:28.214829+00:00", "identitySourceId": "ISEXAMPLEabcdefg111111", "lastUpdatedDate": "2023-05-19T20:30:28.214829+00:00", "policyStoreId": "PSEXAMPLEabcdefg111111" } If you change the principal type for the identity source, you must update your schema to correctly reflect the updated principal type. Mapping identity provider tokens to schema You might find that you want to add an identity source to a policy store and map provider claims, or tokens, to your policy store schema. You can automate this process, by using the Guided setup to create your policy store with an identity source, or update your schema manually after the policy store is created. Once you have mapped the tokens to the schema you can create policies that reference them. This section of the user guide has the following information: Mapping tokens to schema 99 Amazon Verified Permissions User Guide • When you can automatically populate attributes to a policy store schema • How to use Amazon Cognito and OIDC token claims in your Verified Permissions policies • How to manually build a schema for an identity source API-linked policy stores and policy stores with an identity source that were created through Guided setup don't require manual mapping of identity (ID) token attributes to schema. You can provide Verified Permissions with the attributes in your user pool and create a schema that is populated with user attributes. In ID token authorization, Verified Permissions maps claims to attributes of a principal entity. You might need to manually map Amazon Cognito tokens to your schema in the following conditions: • You created an empty policy store or policy store from a sample. • You want to extend your use of access tokens beyond role-based access control (RBAC). • You create policy stores with the Verified Permissions REST API, an AWS SDK, or the AWS CDK. To use Amazon Cognito or an OIDC identity provider (IdP) as an identity source in your Verified Permissions policy store, you must have provider attributes in your schema. The schema is fixed and must correspond to the entities that provider tokens create in IsAuthorizedWithToken or BatchIsAuthorizedWithToken API requests. If you created your policy store in a way that automatically populates your schema from provider information in an ID token, you're ready to write policies. If you create a policy store without a schema for your identity source, you must add provider attributes to the schema that match the entities created using API requests. Then you can write policies using attributes from the provider token. For more information about using Amazon Cognito ID and access tokens for authenticated users in Verified Permissions, see Authorization with Amazon Verified Permissions in the Amazon Cognito Developer Guide. Topics • Mapping ID tokens to schema • Mapping access tokens • Alternative notation for Amazon Cognito colon-delimited claims • Things to know about schema mapping Mapping tokens to schema 100 Amazon Verified Permissions User Guide Mapping ID tokens to schema Verified Permissions processes ID token claims as the attributes of the user: their names and titles, their group membership, their contact information. ID tokens are most useful in an attribute-based access control (ABAC) authorization model. When you want Verified Permissions to analyze access to resources based on who's making the request, choose ID tokens for your identity source. Amazon |
amazon-verified-permissions-user-guide-036 | amazon-verified-permissions-user-guide.pdf | 36 | Topics • Mapping ID tokens to schema • Mapping access tokens • Alternative notation for Amazon Cognito colon-delimited claims • Things to know about schema mapping Mapping tokens to schema 100 Amazon Verified Permissions User Guide Mapping ID tokens to schema Verified Permissions processes ID token claims as the attributes of the user: their names and titles, their group membership, their contact information. ID tokens are most useful in an attribute-based access control (ABAC) authorization model. When you want Verified Permissions to analyze access to resources based on who's making the request, choose ID tokens for your identity source. Amazon Cognito ID tokens Amazon Cognito ID tokens work with most OIDC relying-party libraries. They extend the features of OIDC with additional claims. Your application can authenticate the user with Amazon Cognito user pools authentication API operations, or with the user pool hosted UI. For more information, see Using the API and endpoints in the Amazon Cognito Developer Guide. Useful claims in Amazon Cognito ID tokens cognito:username and preferred_username Variants of the user's username. sub The user's unique user identifier (UUID) Claims with a custom: prefix A prefix for custom user pool attributes like custom:employmentStoreCode. Standard claims Standard OIDC claims like email and phone_number. For more information, see Standard claims in OpenID Connect Core 1.0 incorporating errata set 2. cognito:groups A user's group memberships. In an authorization model based on role-based access control (RBAC), this claim presents the roles that you can evaluate in your policies. Transient claims Claims that aren't a property of the user, but are added at runtime by a user pool Pre token generation Lambda trigger. Transient claims resemble standard claims but are outside the standard, for example tenant or department. Mapping ID tokens 101 Amazon Verified Permissions User Guide In policies that reference Amazon Cognito attributes that have a : separator, reference the attributes in the format principal["cognito:username"]. The roles claim cognito:groups is an exception to this rule. Verified Permissions maps the contents of this claim to parent entities of the user entity. For more information about the structure of ID tokens from Amazon Cognito user pools, see Using the ID token in the Amazon Cognito Developer Guide. The following example ID token has each of the four types of attributes. It includes the Amazon Cognito-specific claim cognito:username, the custom claim custom:employmentStoreCode, the standard claim email, and the transient claim tenant. { "sub": "91eb4550-XXX", "cognito:groups": [ "Store-Owner-Role", "Customer" ], "email_verified": true, "clearance": "confidential", "iss": "https://cognito-idp.us-east-2.amazonaws.com/us-east-2_EXAMPLE", "cognito:username": "alice", "custom:employmentStoreCode": "petstore-dallas", "origin_jti": "5b9f50a3-05da-454a-8b99-b79c2349de77", "aud": "1example23456789", "event_id": "0ed5ad5c-7182-4ecf-XXX", "token_use": "id", "auth_time": 1687885407, "department": "engineering", "exp": 1687889006, "iat": 1687885407, "tenant": "x11app-tenant-1", "jti": "a1b2c3d4-e5f6-a1b2-c3d4-TOKEN1111111", "email": "alice@example.com" } When you create an identity source with your Amazon Cognito user pool, you specify the type of principal entity that Verified Permissions generates in authorization requests with IsAuthorizedWithToken. Your policies can then test attributes of that principal as part of evaluating that request. Your schema defines the principal type and attributes for an identity source, and then you can reference them in your Cedar policies. Mapping ID tokens 102 Amazon Verified Permissions User Guide You also specify the type of group entity that you want to derive from the ID token groups claim. In authorization requests, Verified Permissions maps each member of the groups claim to that group entity type. In policies, you can reference that group entity as the principal. The following example shows how to reflect the attributes from the example identity token in your Verified Permissions schema. For more information about editing your schema, see Editing policy store schemas. If your identity source configuration specifies the principal type User, then you can include something similar to the following example to make those attributes available to Cedar. "User": { "shape": { "type": "Record", "attributes": { "cognito:username": { "type": "String", "required": false }, "custom:employmentStoreCode": { "type": "String", "required": false }, "email": { "type": "String" }, "tenant": { "type": "String", "required": true } } } } For an example policy that will validate against this schema, see Reflects Amazon Cognito ID token attributes. OIDC ID tokens Working with ID tokens from an OIDC provider is much the same as working with Amazon Cognito ID tokens. The difference is in the claims. Your IdP might present standard OIDC attributes, or have a custom schema. When you create a new policy store in the Verified Permissions console, you can add an OIDC identity source with an example ID token, or you can manually map token claims to Mapping ID tokens 103 Amazon Verified Permissions User Guide user attributes. Because Verified Permissions isn't aware of the attribute schema of your IdP, you must provide this information. For more information, see Creating Verified Permissions policy stores. The following is an example schema for a policy store with an OIDC identity source. "User": { "shape": { "type": "Record", "attributes": |
amazon-verified-permissions-user-guide-037 | amazon-verified-permissions-user-guide.pdf | 37 | present standard OIDC attributes, or have a custom schema. When you create a new policy store in the Verified Permissions console, you can add an OIDC identity source with an example ID token, or you can manually map token claims to Mapping ID tokens 103 Amazon Verified Permissions User Guide user attributes. Because Verified Permissions isn't aware of the attribute schema of your IdP, you must provide this information. For more information, see Creating Verified Permissions policy stores. The following is an example schema for a policy store with an OIDC identity source. "User": { "shape": { "type": "Record", "attributes": { "email": { "type": "String" }, "email_verified": { "type": "Boolean" }, "name": { "type": "String", "required": true }, "phone_number": { "type": "String" }, "phone_number_verified": { "type": "Boolean" } } } } For an example policy that will validate against this schema, see Reflects OIDC ID token attributes. Mapping access tokens Verified Permissions processes access-token claims other than the groups claim as attributes of the action, or context attributes. Along with group membership, the access tokens from your IdP might contain information about API access. Access tokens are useful in authorization models that use role-based access control (RBAC). Authorization models that rely on access-token claims other than group membership require additional effort in schema configuration. Mapping access tokens 104 Amazon Verified Permissions User Guide Mapping Amazon Cognito access tokens Amazon Cognito access tokens have claims that can be used for authorization: Useful claims in Amazon Cognito access tokens client_id The ID of the client application of an OIDC relying party. With the client ID, Verified Permissions can verify that the authorization request comes from a permitted client for the policy store. In machine-to-machine (M2M) authorization, the requesting system authorizes a request with a client secret and provides the client ID and scopes as evidence of authorization. scope The OAuth 2.0 scopes that represent the access permissions of the bearer of the token. cognito:groups A user's group memberships. In an authorization model based on role-based access control (RBAC), this claim presents the roles that you can evaluate in your policies. Transient claims Claims that aren't an access permission, but are added at runtime by a user pool Pre token generation Lambda trigger. Transient claims resemble standard claims but are outside the standard, for example tenant or department. Customization of access tokens adds cost to your AWS bill. For more information about the structure of access tokens from Amazon Cognito user pools, see Using the access token in the Amazon Cognito Developer Guide. An Amazon Cognito access token is mapped to a context object when passed to Verified Permissions. Attributes of the access token can be referenced using context.token.attribute_name. The following example access token includes both the client_id and scope claims. { "sub": "91eb4550-9091-708c-a7a6-9758ef8b6b1e", "cognito:groups": [ "Store-Owner-Role", Mapping access tokens 105 Amazon Verified Permissions "Customer" User Guide ], "iss": "https://cognito-idp.us-east-2.amazonaws.com/us-east-2_EXAMPLE", "client_id": "1example23456789", "origin_jti": "a1b2c3d4-e5f6-a1b2-c3d4-TOKEN1111111", "event_id": "bda909cb-3e29-4bb8-83e3-ce6808f49011", "token_use": "access", "scope": "MyAPI/mydata.write", "auth_time": 1688092966, "exp": 1688096566, "iat": 1688092966, "jti": "a1b2c3d4-e5f6-a1b2-c3d4-TOKEN2222222", "username": "alice" } The following example shows how to reflect the attributes from the example access token in your Verified Permissions schema. For more information about editing your schema, see Editing policy store schemas. { "MyApplication": { "actions": { "Read": { "appliesTo": { "context": { "type": "ReusedContext" }, "resourceTypes": [ "Application" ], "principalTypes": [ "User" ] } } }, ... ... "commonTypes": { "ReusedContext": { "attributes": { "token": { "type": "Record", Mapping access tokens 106 Amazon Verified Permissions User Guide "attributes": { "scope": { "type": "Set", "element": { "type": "String" } }, "client_id": { "type": "String" } } } }, "type": "Record" } } } } For an example policy that will validate against this schema, see Reflects Amazon Cognito access token attributes. Mapping OIDC access tokens Most access tokens from external OIDC providers align closely with Amazon Cognito access tokens. An OIDC access token is mapped to a context object when passed to Verified Permissions. Attributes of the access token can be referenced using context.token.attribute_name. The following example OIDC access token includes example base claims. { "sub": "91eb4550-9091-708c-a7a6-9758ef8b6b1e", "groups": [ "Store-Owner-Role", "Customer" ], "iss": "https://auth.example.com", "client_id": "1example23456789", "aud": "https://myapplication.example.com" "scope": "MyAPI-Read", "exp": 1688096566, "iat": 1688092966, "jti": "a1b2c3d4-e5f6-a1b2-c3d4-TOKEN2222222", "username": "alice" Mapping access tokens 107 Amazon Verified Permissions } User Guide The following example shows how to reflect the attributes from the example access token in your Verified Permissions schema. For more information about editing your schema, see Editing policy store schemas. { "MyApplication": { "actions": { "Read": { "appliesTo": { "context": { "type": "ReusedContext" }, "resourceTypes": [ "Application" ], "principalTypes": [ "User" ] } } }, ... ... "commonTypes": { "ReusedContext": { "attributes": { "token": { "type": "Record", "attributes": { "scope": { "type": "Set", "element": { "type": "String" } }, "client_id": { "type": "String" } } } }, Mapping access tokens 108 Amazon Verified Permissions |
amazon-verified-permissions-user-guide-038 | amazon-verified-permissions-user-guide.pdf | 38 | Verified Permissions } User Guide The following example shows how to reflect the attributes from the example access token in your Verified Permissions schema. For more information about editing your schema, see Editing policy store schemas. { "MyApplication": { "actions": { "Read": { "appliesTo": { "context": { "type": "ReusedContext" }, "resourceTypes": [ "Application" ], "principalTypes": [ "User" ] } } }, ... ... "commonTypes": { "ReusedContext": { "attributes": { "token": { "type": "Record", "attributes": { "scope": { "type": "Set", "element": { "type": "String" } }, "client_id": { "type": "String" } } } }, Mapping access tokens 108 Amazon Verified Permissions "type": "Record" } } } } User Guide For an example policy that will validate against this schema, see Reflects OIDC access token attributes. Alternative notation for Amazon Cognito colon-delimited claims At the time that Verified Permissions launched, the recommended schema for Amazon Cognito token claims like cognito:groups and custom:store converted these colon-delimited strings to use the . character as a hierarchy delimiter. This format is called dot notation. For example, a reference to cognito:groups became principal.cognito.groups in your policies. Although you can continue to use this format, we recommend that you build your schema and policies with bracket notation. In this format, a reference to cognito:groups becomes principal["cognito:groups"] in your policies. Automatically-generated schemas for user pool ID tokens from the Verified Permissions console use bracket notation. You can continue to use dot notation in manually-built schema and policies for Amazon Cognito identity sources. You can't use dot notation with : or any other non-alphanumeric characters in schema or policies for any other type of OIDC IdP. A schema for dot notation nests each instance of a : character as a child of the cognito or custom initial phrase, as shown in the following example: "CognitoUser": { "shape": { "type": "Record", "attributes": { "cognito": { "type": "Record", "required": true, "attributes": { "username": { "type": "String", "required": true } } }, Alternative notation for Amazon Cognito colon-delimited claims 109 Amazon Verified Permissions User Guide "custom": { "type": "Record", "required": true, "attributes": { "employmentStoreCode": { "type": "String", "required": true } } }, "email": { "type": "String" }, "tenant": { "type": "String", "required": true } } } } For an example policy that will validate against this schema and use dot notation, see Uses dot notation to reference attributes. Things to know about schema mapping Attribute mapping differs between token types In access token authorization, Verified Permissions maps claims to context. In ID token authorization, Verified Permissions maps claims to principal attributes. For policy stores that you create in the Verified Permissions console, only empty and sample policy stores leave you with no identity source and require you to populate your schema with user pool attributes for ID token authorization. Access token authorization is based on role-based access control (RBAC) with group- membership claims and doesn't automatically map other claims to the policy store schema. Identity source attributes aren't required When you create an identity source in the Verified Permissions console, no attributes are marked as required. This prevents missing claims from causing validation errors in authorization requests. You can set attributes to required as needed, but they must be present in all authorization requests. RBAC doesn't require attributes in schema Things to know about schema mapping 110 Amazon Verified Permissions User Guide Schemas for identity sources depend on the entity associations that you make when you add your identity source. An identity source maps one claim to a user entity type, and one claim to a group entity type. These entity mappings are the core of an identity-source configuration. With this minimum information, you can write policies that perform authorization actions for specific users and specific groups that users might be members of, in a role-based access control (RBAC) model. The addition of token claims to the schema extends the authorization scope of your policy store. User attributes from ID tokens have information about users that can contribute to attribute-based access control (ABAC) authorization. Context attributes from access tokens have information like OAuth 2.0 scopes that can contribute additional access-control information from your provider, but require additional schema modifications. The Set up with API Gateway and an identity provider and Guided setup options in the Verified Permissions console assign ID token claims to the schema. This isn't the case for access token claims. To add non-group access-token claims to your schema, you must edit your schema in JSON mode and add commonTypes attributes. For more information, see Mapping access tokens. OIDC groups claim supports multiple formats When you add an OIDC provider, you can choose the name of the groups claim in ID or access tokens that you want to map to a user’s group membership in your policy store. Verified permissions recognizes groups claims in the following formats: 1. String without |
amazon-verified-permissions-user-guide-039 | amazon-verified-permissions-user-guide.pdf | 39 | options in the Verified Permissions console assign ID token claims to the schema. This isn't the case for access token claims. To add non-group access-token claims to your schema, you must edit your schema in JSON mode and add commonTypes attributes. For more information, see Mapping access tokens. OIDC groups claim supports multiple formats When you add an OIDC provider, you can choose the name of the groups claim in ID or access tokens that you want to map to a user’s group membership in your policy store. Verified permissions recognizes groups claims in the following formats: 1. String without spaces: "groups": "MyGroup" 2. Space-delimited list: "groups": "MyGroup1 MyGroup2 MyGroup3". Each string is a group. 3. JSON (comma-delimited) list: "groups": ["MyGroup1", "MyGroup2", "MyGroup3"] Note Verified Permissions interprets each string in a space-separated groups claim as a separate group. To interpret a group name with a space character as a single group, replace or remove the space in the claim. For example, format a group named My Group as MyGroup. Choose a token type The way that your policy store works with your identity source depends on a key decision in identity-source configuration: whether you will process ID or access tokens. With an Amazon Cognito identity provider, you have the choice of token type when you create an API-linked policy Things to know about schema mapping 111 Amazon Verified Permissions User Guide store. When you create an API-linked policy store, you must choose whether you want to set up authorization for ID or access tokens. This information affects the schema attributes that Verified Permissions applies to your policy store, and the syntax of the Lambda authorizer for your API Gateway API. With an OIDC provider, you must choose a token type when you add the identity source. You can choose ID or access token, and your choice excludes the unchosen token type from being processed in your policy store. Especially if you wish to benefit from the automatic mapping of ID token claims to attributes in the Verified Permissions console, decide early about the token type that you want to process before you create your identity source. Changing the token type requires significant effort to refactor your policies and schema. The following topics describe the use of ID and access tokens with policy stores. Cedar parser requires brackets for some characters Policies typically reference schema attributes in a format like principal.username. In the case of most non-alphanumeric characters like :, ., or / that might appear in token claim names, Verified Permissions can't parse a condition value like principal.cognito:username or context.ip-address. You must instead format these conditions with bracket notation in the format principal["cognito:username"] or context["ip-address"], respectively. The underscore character _ is a valid character in claim names, and the only non-alphanumeric exception to this requirement. A partial example schema for a principal attribute of this type looks like the following: "User": { "shape": { "type": "Record", "attributes": { "cognito:username": { "type": "String", "required": true }, "custom:employmentStoreCode": { "type": "String", "required": true, }, "email": { "type": "String", "required": false } } } Things to know about schema mapping 112 Amazon Verified Permissions } User Guide A partial example schema for a context attribute of this type looks like the following: "GetOrder": { "memberOf": [], "appliesTo": { "resourceTypes": [ "Order" ], "context": { "type": "Record", "attributes": { "ip-address": { "required": false, "type": "String" } } }, "principalTypes": [ "User" ] } } For an example policy that will validate against this schema, see Uses bracket notation to reference token attributes. Things to know about schema mapping 113 Amazon Verified Permissions User Guide Implementing authorization in Amazon Verified Permissions After you build your policy store, policies, templates, schema, and authorization model, you're ready to start authorizing requests using Amazon Verified Permissions. To implement Verified Permissions authorization, you must combine configuration of authorization policies in AWS with integration in an application. To integrate Verified Permissions with your application, add an AWS SDK and implement the methods that invoke the Verified Permissions API and generate authorization decisions against your policy store. Authorization with Verified Permissions is useful for UX permissions and API permissions in your applications. UX permissions Control user access to your application UX. You can permit a user to view only the exact forms, buttons, graphics and other resources that they need to access. For example, when a user signs in, you might want to determine whether a "Transfer funds" button is visible in their account. You can also control actions that a user can take. For example, in same banking app you might want to determine whether your user is permitted to change the category of a transaction. API permissions Control user access to data. Applications are often part of a distributed system and bring in information from external APIs. In the |
amazon-verified-permissions-user-guide-040 | amazon-verified-permissions-user-guide.pdf | 40 | You can permit a user to view only the exact forms, buttons, graphics and other resources that they need to access. For example, when a user signs in, you might want to determine whether a "Transfer funds" button is visible in their account. You can also control actions that a user can take. For example, in same banking app you might want to determine whether your user is permitted to change the category of a transaction. API permissions Control user access to data. Applications are often part of a distributed system and bring in information from external APIs. In the example of the banking app where Verified Permissions has permitted the display of a "Transfer funds" button, a more complex authorization decision must be made when your user initiates a transfer. Verified Permissions can authorize the API request that lists the destination accounts that are eligible transfer targets, and then the request to push the transfer to the other account. The examples that illustrate this content come from a sample policy store. To follow along, create the DigitalPetStore sample policy store in your testing environment. For an end to end sample application that implements UX permissions using batch authorization, see Use Amazon Verified Permissions for fine-grained authorization at scale on the AWS Security Blog. Topics 114 Amazon Verified Permissions User Guide • Available API operations for authorization • Testing your authorization model • Integrating your authorization models with applications Available API operations for authorization The Verified Permissions API has the following authorization operations. IsAuthorized The IsAuthorized API operation is the entry point to authorization requests with Verified Permissions. You must submit principal, action, resource, context, and entities elements. Verified Permissions validates the entities in your request against your policy store schema. Verified Permissions then evaluates your request against all policies in the requested policy store that apply to the entities in the request. IsAuthorizedWithToken The IsAuthorizedWithToken operation generates an authorization request from user data in JSON web tokens (JWTs). Verified Permissions works directly with OIDC providers like Amazon Cognito as an identity source in your policy store. Verified Permissions populates all attributes to the principal in your request from the claims in users' ID or access tokens. You can authorize actions and resources from user attributes or group membership in an identity source. You can't include information about group or user principal types in an IsAuthorizedWithToken request. You must populate all principal data to the JWT that you provide. BatchIsAuthorized The BatchIsAuthorized operation processes multiple authorization decisions for a single principal or resource in a single API request. This operation groups requests into a single batch operation that minimizes quota usage and returns authorization decisions for each of up to 30 complex nested actions. With batch authorization for a single resource, you can filter the actions that a user can take on a resource. With batch authorization for a single principal, you can filter for the resources that a user can take action on. BatchIsAuthorizedWithToken The BatchIsAuthorizedWithToken operation processes multiple authorization decisions for a single principal in one API request. The principal is provided by your policy store identity API operations 115 Amazon Verified Permissions User Guide source in an ID or access token. This operation groups requests into a single batch operation that minimizes quota usage and returns authorization decisions for each of up to 30 requests for actions and resources. In your policies, you can authorize their access from their attributes or their group membership in a user directory. Like with IsAuthorizedWithToken, you can't include information about group or user principal types in a BatchIsAuthorizedWithToken request. You must populate all principal data to the JWT that you provide. Testing your authorization model To understand the effect of Amazon Verified Permissions authorization decision when you deploy your application, you can evaluate your policies as you develop them with the Using the Amazon Verified Permissions test bench and with HTTPS REST API requests to Verified Permissions. The test bench is a tool in the AWS Management Console to evaluate authorization requests and responses in your policy store. The Verified Permissions REST API is the next step in your development as you move from a conceptual understanding to application design. The Verified Permissions API accepts authorization requests with IsAuthorized, IsAuthorizedWithToken, and BatchIsAuthorized as signed AWS API requests to Regional service endpoints. To test your authorization model, you can generate requests with any API client and verify that your policies are returning authorization decisions as expected. For example, you can test IsAuthorized in a sample policy store with the following procedure. Test bench 1. Open the Verified Permissions console at Verified Permissions console. Create a policy store from the Sample policy store with the name DigitalPetStore. 2. Select Test bench in your new policy store. 3. Populate your test bench request from |
amazon-verified-permissions-user-guide-041 | amazon-verified-permissions-user-guide.pdf | 41 | Verified Permissions API accepts authorization requests with IsAuthorized, IsAuthorizedWithToken, and BatchIsAuthorized as signed AWS API requests to Regional service endpoints. To test your authorization model, you can generate requests with any API client and verify that your policies are returning authorization decisions as expected. For example, you can test IsAuthorized in a sample policy store with the following procedure. Test bench 1. Open the Verified Permissions console at Verified Permissions console. Create a policy store from the Sample policy store with the name DigitalPetStore. 2. Select Test bench in your new policy store. 3. Populate your test bench request from IsAuthorized in the Verified Permissions API reference. The following details replicate the conditions in Example 4 that references the DigitalPetStore sample. a. Set Alice as the principal. For Principal taking action, choose DigitalPetStore::User and enter Alice. Test model 116 Amazon Verified Permissions User Guide b. Set Alice's role as customer. Choose Add a parent, choose DigitalPetStore::Role, and enter Customer. c. Set the resource as order "1234." For Resource that the principal is acting on, choose DigitalPetStore::Order and enter 1234. d. The DigitalPetStore::Order resource requires an owner attribute. Set Alice as the owner of the order. Choose DigitalPetStore::User and enter Alice e. Alice requested to view the order. For Action that principal is taking, choose DigitalPetStore::Action::"GetOrder". 4. Choose Run authorization request. In an unmodified policy store, this request results in an ALLOW decision. Note the Satisfied policy that returned the decision. 5. Choose Policies from the left navigation bar. Review the static policy with the description Customer Role - Get Order. 6. Observe that Verified Permissions allowed the request because the principal was in a customer role and was the owner of the resource. REST API 1. Open the Verified Permissions console at Verified Permissions console. Create a policy store from the Sample policy store with the name DigitalPetStore. 2. Note the Policy store ID of your new policy store. 3. From IsAuthorized in the Verified Permissions API reference, copy the request body of Example 4 that references the DigitalPetStore sample. 4. Open your API client and create a request to the Regional service endpoint for your policy store. Populate the headers as shown in the example. 5. Paste in the sample request body and change the value of policyStoreId to the policy store ID you noted earlier. 6. Submit the request and review the results. In a default DigitalPetStore policy store, this request returns an ALLOW decision. You can make changes to policies, schema, and requests in your test environment to change the outcomes and produce more complex decisions. 1. Change the request in a way that changes the decision from Verified Permissions. For example, change Alice's role to Employee or change the owner attribute of order 1234 to Bob. Test model 117 Amazon Verified Permissions User Guide 2. Change policies in ways that affect authorization decisions. For example, modify the policy with the description Customer Role - Get Order to remove the condition that the User must be the owner of the Resource and modify the request so that Bob wants to view the order. 3. Change the schema to allow policies to make a more complex decision. Update the request entities so that Alice can satisfy the new requirements. For example, edit the schema to allow User to be a member of ActiveUsers or InactiveUsers. Update the policy so that only active users can view their own orders. Update the request entities so that Alice is an active or inactive user. Integrating your authorization models with applications To implement Amazon Verified Permissions in your application, you must define the policies and schema that you want your app to enforce. With your authorization model in place and tested, your next step is to start generating API requests from the point of enforcement. To do this, you must set up application logic to collect user data and populate it to authorization requests. How an app authorizes requests with Verified Permissions 1. Gather information about the current user. Typically, a user's details are provided in the details of an authenticated session, like a JWT or web session cookie. This user data might originate from an Amazon Cognito identity source linked to your policy store or from another OpenID Connect (OIDC) provider. 2. Gather information about the resource that a user wants to access. Typically, your application will receive information about the resource when a user makes a selection that requires your app to load a new asset. 3. Determine the action that your user wants to take. 4. Generate an authorization request to Verified Permissions with the principal, action, resource, and entities for your user's attempted operation.Verified Permissions evaluates the request against the policies in your policy store and returns an authorization decision. 5. Your application reads the allow or deny |
amazon-verified-permissions-user-guide-042 | amazon-verified-permissions-user-guide.pdf | 42 | your policy store or from another OpenID Connect (OIDC) provider. 2. Gather information about the resource that a user wants to access. Typically, your application will receive information about the resource when a user makes a selection that requires your app to load a new asset. 3. Determine the action that your user wants to take. 4. Generate an authorization request to Verified Permissions with the principal, action, resource, and entities for your user's attempted operation.Verified Permissions evaluates the request against the policies in your policy store and returns an authorization decision. 5. Your application reads the allow or deny response from Verified Permissions and enforces the decision on the user's request. Verified Permissions API operations are built into AWS SDKs. To include Verified Permissions in an app, integrate the AWS SDK for your chosen language into the app package. To learn more and download AWS SDKs, see Tools for Amazon Web Services. Integrating with applications 118 Amazon Verified Permissions User Guide The following are links to documentation for Verified Permissions resources in various AWS SDKs. • AWS SDK for .NET • AWS SDK for C++ • AWS SDK for Go • AWS SDK for Java • AWS SDK for JavaScript • AWS SDK for PHP • AWS SDK for Python (Boto) • AWS SDK for Ruby • AWS SDK for Rust The following AWS SDK for JavaScript example for IsAuthorized originates from Simplify fine- grained authorization with Amazon Verified Permissions and Amazon Cognito. const authResult = await avp.isAuthorized({ principal: 'User::"alice"', action: 'Action::"view"', resource: 'Photo::"VacationPhoto94.jpg"', // whenever our policy references attributes of the entity, // isAuthorized needs an entity argument that provides // those attributes entities: { entityList: [ { "identifier": { "entityType": "User", "entityId": "alice" }, "attributes": { "location": { "String": "USA" } } } ] } }); Integrating with applications 119 Amazon Verified Permissions More developer resources • Amazon Verified Permissions workshop • Amazon Verified Permissions - Resources User Guide • Implement custom authorization policy provider for ASP.NET Core apps using Amazon Verified Permissions • Build an entitlement service for business applications using Amazon Verified Permissions • Simplify fine-grained authorization with Amazon Verified Permissions and Amazon Cognito Integrating with applications 120 Amazon Verified Permissions User Guide Security in Amazon Verified Permissions Cloud security at AWS is the highest priority. As an AWS customer, you benefit from data centers and network architectures that are built to meet the requirements of the most security-sensitive organizations. Security is a shared responsibility between AWS and you. The shared responsibility model describes this as security of the cloud and security in the cloud: • Security of the cloud – AWS is responsible for protecting the infrastructure that runs AWS services in the AWS Cloud. AWS also provides you with services that you can use securely. Third- party auditors regularly test and verify the effectiveness of our security as part of the AWS Compliance Programs. To learn about the compliance programs that apply to Amazon Verified Permissions, see AWS Services in Scope by Compliance Program. • Security in the cloud – Your responsibility is determined by the AWS service that you use. You are also responsible for other factors including the sensitivity of your data, your company’s requirements, and applicable laws and regulations. This documentation helps you understand how to apply the shared responsibility model when using Verified Permissions. The following topics show you how to configure Verified Permissions to meet your security and compliance objectives. You also learn how to use other AWS services that help you to monitor and secure your Verified Permissions resources. Topics • Data protection in Amazon Verified Permissions • Identity and access management for Amazon Verified Permissions • Compliance validation for Amazon Verified Permissions • Resilience in Amazon Verified Permissions Data protection in Amazon Verified Permissions The AWS shared responsibility model applies to data protection in Amazon Verified Permissions. As described in this model, AWS is responsible for protecting the global infrastructure that runs all of the AWS Cloud. You are responsible for maintaining control over your content that is hosted on this infrastructure. This content includes the security configuration and management tasks for the Data protection 121 Amazon Verified Permissions User Guide AWS services that you use. For more information about data privacy, see the Data Privacy FAQ. For information about data protection in Europe, see the AWS Shared Responsibility Model and GDPR blog post on the AWS Security Blog. • For data protection purposes, we recommend that you protect AWS account credentials and set up individual users with AWS IAM Identity Center or AWS Identity and Access Management (IAM). That way, each user is given only the permissions necessary to fulfill their job duties. • We recommend that you secure your data in the following ways: • Use multi-factor authentication (MFA) with each account. • Use |
amazon-verified-permissions-user-guide-043 | amazon-verified-permissions-user-guide.pdf | 43 | For more information about data privacy, see the Data Privacy FAQ. For information about data protection in Europe, see the AWS Shared Responsibility Model and GDPR blog post on the AWS Security Blog. • For data protection purposes, we recommend that you protect AWS account credentials and set up individual users with AWS IAM Identity Center or AWS Identity and Access Management (IAM). That way, each user is given only the permissions necessary to fulfill their job duties. • We recommend that you secure your data in the following ways: • Use multi-factor authentication (MFA) with each account. • Use SSL/TLS to communicate with AWS resources. We require TLS 1.2. • Set up API and user activity logging with AWS CloudTrail. • Use AWS encryption solutions, along with all default security controls within AWS services. • Use advanced managed security services such as Amazon Macie, which assists in discovering and securing sensitive data that is stored in Amazon S3. • If you require FIPS 140-2 validated cryptographic modules when accessing AWS through a command line interface or an API, use a FIPS endpoint. For more information about the available FIPS endpoints, see Federal Information Processing Standard (FIPS) 140-2. • We strongly recommend that you never put confidential or sensitive information, such as your customers' email addresses, into tags or free-form text fields such as a Name field. This includes when you work with Verified Permissions or other AWS services using the console, API, AWS CLI, or AWS SDKs. Any data that you enter into tags or free-form text fields used for names may be used for billing or diagnostic logs. If you provide a URL to an external server, we strongly recommend that you do not include credentials information in the URL to validate your request to that server. • Your action names should not include any sensitive information. • We also strongly recommend that you always use unique, non-mutable, and non-reusable identifiers for your entities (resources and principals). In a test environment, you might choose to use simple entity identifiers, such as jane or bob for the name of an entity of type User. However, in a production system, it’s critical for security reasons that you use unique values that can’t be reused. We recommend that you use values like universally unique identifiers (UUIDs). For example, consider the user jane who leaves the company. Later, you let someone else use the name jane. That new user gets access automatically to everything granted by policies that still reference User::"jane". Verified Permissions and Cedar can’t distinguish between the new user and the previous user. Data protection 122 Amazon Verified Permissions User Guide This guidance applies to both principal and resource identifiers. Always use identifiers that are guaranteed unique and never reused to ensure that you don’t grant access unintentionally because of the presence of an old identifier in a policy. • Ensure that the strings that you provide to define Long and Decimal values are within the valid range of each type. Also, ensure that your use of any arithmetic operators don't result in a value outside of the valid range. If the range is exceeded, the operation results in an overflow exception. A policy that results in an error is ignored, meaning that a Permit policy might unexpectedly fail to allow access, or a Forbid policy might unexpectedly fail to block access. Data encryption Amazon Verified Permissions automatically encrypts all customer data such as policies with an AWS managed key, so the use of a customer managed key is neither necessary nor supported. Identity and access management for Amazon Verified Permissions AWS Identity and Access Management (IAM) is an AWS service that helps an administrator securely control access to AWS resources. IAM administrators control who can be authenticated (signed in) and authorized (have permissions) to use Verified Permissions resources. IAM is an AWS service that you can use with no additional charge. Topics • Audience • Authenticating with identities • Managing access using policies • How Amazon Verified Permissions works with IAM • IAM policies for Verified Permissions • Identity-based policy examples for Amazon Verified Permissions • AWS managed policies for Amazon Verified Permissions • Troubleshooting Amazon Verified Permissions identity and access Data encryption 123 Amazon Verified Permissions Audience User Guide How you use AWS Identity and Access Management (IAM) differs, depending on the work that you do in Verified Permissions. Service user – If you use the Verified Permissions service to do your job, then your administrator provides you with the credentials and permissions that you need. As you use more Verified Permissions features to do your work, you might need additional permissions. Understanding how access is managed can help you request the right permissions from your administrator. If you cannot access a feature in Verified Permissions, see Troubleshooting |
amazon-verified-permissions-user-guide-044 | amazon-verified-permissions-user-guide.pdf | 44 | and access Data encryption 123 Amazon Verified Permissions Audience User Guide How you use AWS Identity and Access Management (IAM) differs, depending on the work that you do in Verified Permissions. Service user – If you use the Verified Permissions service to do your job, then your administrator provides you with the credentials and permissions that you need. As you use more Verified Permissions features to do your work, you might need additional permissions. Understanding how access is managed can help you request the right permissions from your administrator. If you cannot access a feature in Verified Permissions, see Troubleshooting Amazon Verified Permissions identity and access. Service administrator – If you're in charge of Verified Permissions resources at your company, you probably have full access to Verified Permissions. It's your job to determine which Verified Permissions features and resources your service users should access. You must then submit requests to your IAM administrator to change the permissions of your service users. Review the information on this page to understand the basic concepts of IAM. To learn more about how your company can use IAM with Verified Permissions, see How Amazon Verified Permissions works with IAM. IAM administrator – If you're an IAM administrator, you might want to learn details about how you can write policies to manage access to Verified Permissions. To view example Verified Permissions identity-based policies that you can use in IAM, see Identity-based policy examples for Amazon Verified Permissions. Authenticating with identities Authentication is how you sign in to AWS using your identity credentials. You must be authenticated (signed in to AWS) as the AWS account root user, as an IAM user, or by assuming an IAM role. You can sign in to AWS as a federated identity by using credentials provided through an identity source. AWS IAM Identity Center (IAM Identity Center) users, your company's single sign-on authentication, and your Google or Facebook credentials are examples of federated identities. When you sign in as a federated identity, your administrator previously set up identity federation using IAM roles. When you access AWS by using federation, you are indirectly assuming a role. Depending on the type of user you are, you can sign in to the AWS Management Console or the AWS access portal. For more information about signing in to AWS, see How to sign in to your AWS account in the AWS Sign-In User Guide. Audience 124 Amazon Verified Permissions User Guide If you access AWS programmatically, AWS provides a software development kit (SDK) and a command line interface (CLI) to cryptographically sign your requests by using your credentials. If you don't use AWS tools, you must sign requests yourself. For more information about using the recommended method to sign requests yourself, see AWS Signature Version 4 for API requests in the IAM User Guide. Regardless of the authentication method that you use, you might be required to provide additional security information. For example, AWS recommends that you use multi-factor authentication (MFA) to increase the security of your account. To learn more, see Multi-factor authentication in the AWS IAM Identity Center User Guide and AWS Multi-factor authentication in IAM in the IAM User Guide. AWS account root user When you create an AWS account, you begin with one sign-in identity that has complete access to all AWS services and resources in the account. This identity is called the AWS account root user and is accessed by signing in with the email address and password that you used to create the account. We strongly recommend that you don't use the root user for your everyday tasks. Safeguard your root user credentials and use them to perform the tasks that only the root user can perform. For the complete list of tasks that require you to sign in as the root user, see Tasks that require root user credentials in the IAM User Guide. Federated identity As a best practice, require human users, including users that require administrator access, to use federation with an identity provider to access AWS services by using temporary credentials. A federated identity is a user from your enterprise user directory, a web identity provider, the AWS Directory Service, the Identity Center directory, or any user that accesses AWS services by using credentials provided through an identity source. When federated identities access AWS accounts, they assume roles, and the roles provide temporary credentials. For centralized access management, we recommend that you use AWS IAM Identity Center. You can create users and groups in IAM Identity Center, or you can connect and synchronize to a set of users and groups in your own identity source for use across all your AWS accounts and applications. For information about IAM Identity Center, see What is IAM Identity Center? in the AWS IAM Identity Center User Guide. Authenticating |
amazon-verified-permissions-user-guide-045 | amazon-verified-permissions-user-guide.pdf | 45 | any user that accesses AWS services by using credentials provided through an identity source. When federated identities access AWS accounts, they assume roles, and the roles provide temporary credentials. For centralized access management, we recommend that you use AWS IAM Identity Center. You can create users and groups in IAM Identity Center, or you can connect and synchronize to a set of users and groups in your own identity source for use across all your AWS accounts and applications. For information about IAM Identity Center, see What is IAM Identity Center? in the AWS IAM Identity Center User Guide. Authenticating with identities 125 Amazon Verified Permissions IAM users and groups User Guide An IAM user is an identity within your AWS account that has specific permissions for a single person or application. Where possible, we recommend relying on temporary credentials instead of creating IAM users who have long-term credentials such as passwords and access keys. However, if you have specific use cases that require long-term credentials with IAM users, we recommend that you rotate access keys. For more information, see Rotate access keys regularly for use cases that require long- term credentials in the IAM User Guide. An IAM group is an identity that specifies a collection of IAM users. You can't sign in as a group. You can use groups to specify permissions for multiple users at a time. Groups make permissions easier to manage for large sets of users. For example, you could have a group named IAMAdmins and give that group permissions to administer IAM resources. Users are different from roles. A user is uniquely associated with one person or application, but a role is intended to be assumable by anyone who needs it. Users have permanent long-term credentials, but roles provide temporary credentials. To learn more, see Use cases for IAM users in the IAM User Guide. IAM roles An IAM role is an identity within your AWS account that has specific permissions. It is similar to an IAM user, but is not associated with a specific person. You can temporarily assume an IAM role in the AWS Management Console by switching roles. You can assume a role by calling an AWS CLI or AWS API operation or by using a custom URL. For more information about methods for using roles, see Using IAM roles in the IAM User Guide. IAM roles with temporary credentials are useful in the following situations: • Federated user access – To assign permissions to a federated identity, you create a role and define permissions for the role. When a federated identity authenticates, the identity is associated with the role and is granted the permissions that are defined by the role. For information about roles for federation, see Create a role for a third-party identity provider (federation) in the IAM User Guide. If you use IAM Identity Center, you configure a permission set. To control what your identities can access after they authenticate, IAM Identity Center correlates the permission set to a role in IAM. For information about permissions sets, see Permission sets in the AWS IAM Identity Center User Guide. • Temporary IAM user permissions – An IAM user or role can assume an IAM role to temporarily take on different permissions for a specific task. Authenticating with identities 126 Amazon Verified Permissions User Guide • Cross-account access – You can use an IAM role to allow someone (a trusted principal) in a different account to access resources in your account. Roles are the primary way to grant cross- account access. However, with some AWS services, you can attach a policy directly to a resource (instead of using a role as a proxy). To learn the difference between roles and resource-based policies for cross-account access, see How IAM roles differ from resource-based policies in the IAM User Guide. • Applications running on Amazon EC2 – You can use an IAM role to manage temporary credentials for applications that are running on an EC2 instance and making AWS CLI or AWS API requests. This is preferable to storing access keys within the EC2 instance. To assign an AWS role to an EC2 instance and make it available to all of its applications, you create an instance profile that is attached to the instance. An instance profile contains the role and enables programs that are running on the EC2 instance to get temporary credentials. For more information, see Use an IAM role to grant permissions to applications running on Amazon EC2 instances in the IAM User Guide. To learn whether to use IAM roles or IAM users, see When to create an IAM role (instead of a user) in the IAM User Guide. Managing access using policies You control access in AWS by creating policies and attaching them to AWS identities or |
amazon-verified-permissions-user-guide-046 | amazon-verified-permissions-user-guide.pdf | 46 | applications, you create an instance profile that is attached to the instance. An instance profile contains the role and enables programs that are running on the EC2 instance to get temporary credentials. For more information, see Use an IAM role to grant permissions to applications running on Amazon EC2 instances in the IAM User Guide. To learn whether to use IAM roles or IAM users, see When to create an IAM role (instead of a user) in the IAM User Guide. Managing access using policies You control access in AWS by creating policies and attaching them to AWS identities or resources. A policy is an object in AWS that, when associated with an identity or resource, defines their permissions. AWS evaluates these policies when a principal (user, root user, or role session) makes a request. Permissions in the policies determine whether the request is allowed or denied. Most policies are stored in AWS as JSON documents. For more information about the structure and contents of JSON policy documents, see Overview of JSON policies in the IAM User Guide. Administrators can use AWS JSON policies to specify who has access to what. That is, which principal can perform actions on what resources, and under what conditions. By default, users and roles have no permissions. To grant users permission to perform actions on the resources that they need, an IAM administrator can create IAM policies. The administrator can then add the IAM policies to roles, and users can assume the roles. IAM policies define permissions for an action regardless of the method that you use to perform the operation. For example, suppose that you have a policy that allows the iam:GetRole action. A user with that policy can get role information from the AWS Management Console, the AWS CLI, or the AWS API. Managing access using policies 127 Amazon Verified Permissions Identity-based policies User Guide Identity-based policies are JSON permissions policy documents that you can attach to an identity, such as an IAM user, group of users, or role. These policies control what actions users and roles can perform, on which resources, and under what conditions. To learn how to create an identity-based policy, see Define custom IAM permissions with customer managed policies in the IAM User Guide. Identity-based policies can be further categorized as inline policies or managed policies. Inline policies are embedded directly into a single user, group, or role. Managed policies are standalone policies that you can attach to multiple users, groups, and roles in your AWS account. Managed policies include AWS managed policies and customer managed policies. To learn how to choose between a managed policy or an inline policy, see Choose between managed policies and inline policies in the IAM User Guide. Resource-based policies Resource-based policies are JSON policy documents that you attach to a resource. Examples of resource-based policies are IAM role trust policies and Amazon S3 bucket policies. In services that support resource-based policies, service administrators can use them to control access to a specific resource. For the resource where the policy is attached, the policy defines what actions a specified principal can perform on that resource and under what conditions. You must specify a principal in a resource-based policy. Principals can include accounts, users, roles, federated users, or AWS services. Resource-based policies are inline policies that are located in that service. You can't use AWS managed policies from IAM in a resource-based policy. Access control lists (ACLs) Access control lists (ACLs) control which principals (account members, users, or roles) have permissions to access a resource. ACLs are similar to resource-based policies, although they do not use the JSON policy document format. Amazon S3, AWS WAF, and Amazon VPC are examples of services that support ACLs. To learn more about ACLs, see Access control list (ACL) overview in the Amazon Simple Storage Service Developer Guide. Managing access using policies 128 Amazon Verified Permissions Other policy types User Guide AWS supports additional, less-common policy types. These policy types can set the maximum permissions granted to you by the more common policy types. • Permissions boundaries – A permissions boundary is an advanced feature in which you set the maximum permissions that an identity-based policy can grant to an IAM entity (IAM user or role). You can set a permissions boundary for an entity. The resulting permissions are the intersection of an entity's identity-based policies and its permissions boundaries. Resource-based policies that specify the user or role in the Principal field are not limited by the permissions boundary. An explicit deny in any of these policies overrides the allow. For more information about permissions boundaries, see Permissions boundaries for IAM entities in the IAM User Guide. • Service control policies (SCPs) – SCPs are JSON policies that specify the maximum permissions for an organization or organizational unit |
amazon-verified-permissions-user-guide-047 | amazon-verified-permissions-user-guide.pdf | 47 | to an IAM entity (IAM user or role). You can set a permissions boundary for an entity. The resulting permissions are the intersection of an entity's identity-based policies and its permissions boundaries. Resource-based policies that specify the user or role in the Principal field are not limited by the permissions boundary. An explicit deny in any of these policies overrides the allow. For more information about permissions boundaries, see Permissions boundaries for IAM entities in the IAM User Guide. • Service control policies (SCPs) – SCPs are JSON policies that specify the maximum permissions for an organization or organizational unit (OU) in AWS Organizations. AWS Organizations is a service for grouping and centrally managing multiple AWS accounts that your business owns. If you enable all features in an organization, then you can apply service control policies (SCPs) to any or all of your accounts. The SCP limits permissions for entities in member accounts, including each AWS account root user. For more information about Organizations and SCPs, see Service control policies in the AWS Organizations User Guide. • Resource control policies (RCPs) – RCPs are JSON policies that you can use to set the maximum available permissions for resources in your accounts without updating the IAM policies attached to each resource that you own. The RCP limits permissions for resources in member accounts and can impact the effective permissions for identities, including the AWS account root user, regardless of whether they belong to your organization. For more information about Organizations and RCPs, including a list of AWS services that support RCPs, see Resource control policies (RCPs) in the AWS Organizations User Guide. • Session policies – Session policies are advanced policies that you pass as a parameter when you programmatically create a temporary session for a role or federated user. The resulting session's permissions are the intersection of the user or role's identity-based policies and the session policies. Permissions can also come from a resource-based policy. An explicit deny in any of these policies overrides the allow. For more information, see Session policies in the IAM User Guide. Managing access using policies 129 Amazon Verified Permissions Multiple policy types User Guide When multiple types of policies apply to a request, the resulting permissions are more complicated to understand. To learn how AWS determines whether to allow a request when multiple policy types are involved, see Policy evaluation logic in the IAM User Guide. How Amazon Verified Permissions works with IAM Before you use IAM to manage access to Verified Permissions, learn what IAM features are available to use with Verified Permissions. IAM features you can use with Amazon Verified Permissions IAM feature Verified Permissions support Identity-based policies Resource-based policies Policy actions Policy resources Policy condition keys ACLs ABAC (tags in policies) Temporary credentials Principal permissions Service roles Service-linked roles Yes No Yes Yes No No No Yes Yes No No To get a high-level view of how Verified Permissions and other AWS services work with most IAM features, see AWS services that work with IAM in the IAM User Guide. How Amazon Verified Permissions works with IAM 130 Amazon Verified Permissions User Guide Identity-based policies for Verified Permissions Supports identity-based policies Yes Identity-based policies are JSON permissions policy documents that you can attach to an identity, such as an IAM user, group of users, or role. These policies control what actions users and roles can perform, on which resources, and under what conditions. To learn how to create an identity-based policy, see Define custom IAM permissions with customer managed policies in the IAM User Guide. With IAM identity-based policies, you can specify allowed or denied actions and resources as well as the conditions under which actions are allowed or denied. You can't specify the principal in an identity-based policy because it applies to the user or role to which it is attached. To learn about all of the elements that you can use in a JSON policy, see IAM JSON policy elements reference in the IAM User Guide. Identity-based policy examples for Verified Permissions To view examples of Verified Permissions identity-based policies, see Identity-based policy examples for Amazon Verified Permissions. Resource-based policies within Verified Permissions Supports resource-based policies No Resource-based policies are JSON policy documents that you attach to a resource. Examples of resource-based policies are IAM role trust policies and Amazon S3 bucket policies. In services that support resource-based policies, service administrators can use them to control access to a specific resource. For the resource where the policy is attached, the policy defines what actions a specified principal can perform on that resource and under what conditions. You must specify a principal in a resource-based policy. Principals can include accounts, users, roles, federated users, or AWS services. To enable cross-account access, you can specify an entire account or IAM entities |
amazon-verified-permissions-user-guide-048 | amazon-verified-permissions-user-guide.pdf | 48 | are JSON policy documents that you attach to a resource. Examples of resource-based policies are IAM role trust policies and Amazon S3 bucket policies. In services that support resource-based policies, service administrators can use them to control access to a specific resource. For the resource where the policy is attached, the policy defines what actions a specified principal can perform on that resource and under what conditions. You must specify a principal in a resource-based policy. Principals can include accounts, users, roles, federated users, or AWS services. To enable cross-account access, you can specify an entire account or IAM entities in another account as the principal in a resource-based policy. Adding a cross-account principal to a resource- based policy is only half of establishing the trust relationship. When the principal and the resource How Amazon Verified Permissions works with IAM 131 Amazon Verified Permissions User Guide are in different AWS accounts, an IAM administrator in the trusted account must also grant the principal entity (user or role) permission to access the resource. They grant permission by attaching an identity-based policy to the entity. However, if a resource-based policy grants access to a principal in the same account, no additional identity-based policy is required. For more information, see Cross account resource access in IAM in the IAM User Guide. Policy actions for Verified Permissions Supports policy actions Yes Administrators can use AWS JSON policies to specify who has access to what. That is, which principal can perform actions on what resources, and under what conditions. The Action element of a JSON policy describes the actions that you can use to allow or deny access in a policy. Policy actions usually have the same name as the associated AWS API operation. There are some exceptions, such as permission-only actions that don't have a matching API operation. There are also some operations that require multiple actions in a policy. These additional actions are called dependent actions. Include actions in a policy to grant permissions to perform the associated operation. To see a list of Verified Permissions actions, see Actions defined by Amazon Verified Permissions in the Service Authorization Reference. Policy actions in Verified Permissions use the following prefix before the action: verifiedpermissions To specify multiple actions in a single statement, separate them with commas. "Action": [ "verifiedpermissions:action1", "verifiedpermissions:action2" ] You can specify multiple actions using wildcards (*). For example, to specify all actions that begin with the word Get, include the following action: How Amazon Verified Permissions works with IAM 132 Amazon Verified Permissions User Guide "Action": "verifiedpermissions:Get*" To view examples of Verified Permissions identity-based policies, see Identity-based policy examples for Amazon Verified Permissions. Policy resources for Verified Permissions Supports policy resources Yes Administrators can use AWS JSON policies to specify who has access to what. That is, which principal can perform actions on what resources, and under what conditions. The Resource JSON policy element specifies the object or objects to which the action applies. Statements must include either a Resource or a NotResource element. As a best practice, specify a resource using its Amazon Resource Name (ARN). You can do this for actions that support a specific resource type, known as resource-level permissions. For actions that don't support resource-level permissions, such as listing operations, use a wildcard (*) to indicate that the statement applies to all resources. "Resource": "*" To see a list of Verified Permissions resource types and their ARNs, see Resource types defined by Amazon Verified Permissions in the Service Authorization Reference. To learn with which actions you can specify the ARN of each resource, see Actions defined by Amazon Verified Permissions. Policy condition keys for Verified Permissions Supports service-specific policy condition keys No Administrators can use AWS JSON policies to specify who has access to what. That is, which principal can perform actions on what resources, and under what conditions. The Condition element (or Condition block) lets you specify conditions in which a statement is in effect. The Condition element is optional. You can create conditional expressions that use condition operators, such as equals or less than, to match the condition in the policy with values in the request. How Amazon Verified Permissions works with IAM 133 Amazon Verified Permissions User Guide If you specify multiple Condition elements in a statement, or multiple keys in a single Condition element, AWS evaluates them using a logical AND operation. If you specify multiple values for a single condition key, AWS evaluates the condition using a logical OR operation. All of the conditions must be met before the statement's permissions are granted. You can also use placeholder variables when you specify conditions. For example, you can grant an IAM user permission to access a resource only if it is tagged with their IAM user name. For more information, see IAM policy elements: |
amazon-verified-permissions-user-guide-049 | amazon-verified-permissions-user-guide.pdf | 49 | Permissions User Guide If you specify multiple Condition elements in a statement, or multiple keys in a single Condition element, AWS evaluates them using a logical AND operation. If you specify multiple values for a single condition key, AWS evaluates the condition using a logical OR operation. All of the conditions must be met before the statement's permissions are granted. You can also use placeholder variables when you specify conditions. For example, you can grant an IAM user permission to access a resource only if it is tagged with their IAM user name. For more information, see IAM policy elements: variables and tags in the IAM User Guide. AWS supports global condition keys and service-specific condition keys. To see all AWS global condition keys, see AWS global condition context keys in the IAM User Guide. ACLs in Verified Permissions Supports ACLs No Access control lists (ACLs) control which principals (account members, users, or roles) have permissions to access a resource. ACLs are similar to resource-based policies, although they do not use the JSON policy document format. ABAC with Verified Permissions Supports ABAC (tags in policies) No Attribute-based access control (ABAC) is an authorization strategy that defines permissions based on attributes. In AWS, these attributes are called tags. You can attach tags to IAM entities (users or roles) and to many AWS resources. Tagging entities and resources is the first step of ABAC. Then you design ABAC policies to allow operations when the principal's tag matches the tag on the resource that they are trying to access. ABAC is helpful in environments that are growing rapidly and helps with situations where policy management becomes cumbersome. To control access based on tags, you provide tag information in the condition element of a policy using the aws:ResourceTag/key-name, aws:RequestTag/key-name, or aws:TagKeys condition keys. How Amazon Verified Permissions works with IAM 134 Amazon Verified Permissions User Guide If a service supports all three condition keys for every resource type, then the value is Yes for the service. If a service supports all three condition keys for only some resource types, then the value is Partial. For more information about ABAC, see Define permissions with ABAC authorization in the IAM User Guide. To view a tutorial with steps for setting up ABAC, see Use attribute-based access control (ABAC) in the IAM User Guide. Using temporary credentials with Verified Permissions Supports temporary credentials Yes Some AWS services don't work when you sign in using temporary credentials. For additional information, including which AWS services work with temporary credentials, see AWS services that work with IAM in the IAM User Guide. You are using temporary credentials if you sign in to the AWS Management Console using any method except a user name and password. For example, when you access AWS using your company's single sign-on (SSO) link, that process automatically creates temporary credentials. You also automatically create temporary credentials when you sign in to the console as a user and then switch roles. For more information about switching roles, see Switch from a user to an IAM role (console) in the IAM User Guide. You can manually create temporary credentials using the AWS CLI or AWS API. You can then use those temporary credentials to access AWS. AWS recommends that you dynamically generate temporary credentials instead of using long-term access keys. For more information, see Temporary security credentials in IAM. Cross-service principal permissions for Verified Permissions Supports principal permissions Yes When you use an IAM user or role to perform actions in AWS, you are considered a principal. When you use some services, you might perform an action that then initiates another action in a different service. FAS uses the permissions of the principal calling an AWS service, combined with the requesting AWS service to make requests to downstream services. FAS requests are only made How Amazon Verified Permissions works with IAM 135 Amazon Verified Permissions User Guide when a service receives a request that requires interactions with other AWS services or resources to complete. In this case, you must have permissions to perform both actions. For policy details when making FAS requests, see Forward access sessions. Service roles for Verified Permissions Supports service roles No A service role is an IAM role that a service assumes to perform actions on your behalf. An IAM administrator can create, modify, and delete a service role from within IAM. For more information, see Create a role to delegate permissions to an AWS service in the IAM User Guide. Service-linked roles for Verified Permissions Supports service-linked roles No A service-linked role is a type of service role that is linked to an AWS service. The service can assume the role to perform an action on your behalf. Service-linked roles appear in your AWS account and are owned by the service. An IAM |
amazon-verified-permissions-user-guide-050 | amazon-verified-permissions-user-guide.pdf | 50 | is an IAM role that a service assumes to perform actions on your behalf. An IAM administrator can create, modify, and delete a service role from within IAM. For more information, see Create a role to delegate permissions to an AWS service in the IAM User Guide. Service-linked roles for Verified Permissions Supports service-linked roles No A service-linked role is a type of service role that is linked to an AWS service. The service can assume the role to perform an action on your behalf. Service-linked roles appear in your AWS account and are owned by the service. An IAM administrator can view, but not edit the permissions for service-linked roles. For details about creating or managing service-linked roles, see AWS services that work with IAM. Find a service in the table that includes a Yes in the Service-linked role column. Choose the Yes link to view the service-linked role documentation for that service. IAM policies for Verified Permissions Verified Permissions manages the permissions of users within your application. In order for your application to call the Verified Permissions APIs or for AWS Management Console users to be allowed to manage Cedar policies in a Verified Permissions policy store, you must add the necessary IAM permissions. Identity-based policies are JSON permissions policy documents that you can attach to an identity, such as an IAM user, group of users, or role. These policies control what actions users and roles can perform, on which resources, and under what conditions. To learn how to create an identity-based policy, see Creating IAM policies in the IAM User Guide. IAM policies for Verified Permissions 136 Amazon Verified Permissions User Guide With IAM identity-based policies, you can specify allowed or denied actions and resources as well as the conditions under which actions are allowed or denied (listed below). You can't specify the principal in an identity-based policy because it applies to the user or role to which it is attached. To learn about all of the elements that you can use in a JSON policy, see IAM JSON policy elements reference in the IAM User Guide. Action CreatePolicyStore DeletePolicyStore ListPolicyStores Description Action to create a new policy store. Action to delete a policy store. Action to list all policy stores in the AWS account. UpdatePolicyStore Action to update a policy store. CreatePolicy DeletePolicy GetPolicy ListPolicies UpdatePolicy IsAuthorized IsAuthorizedWithToken Action to create a Cedar policy in a policy store. You can create either a static policy or a policy linked to a policy template. Action to delete a policy from a policy store. Action to retrieve information about a specified policy. Action to list all policies in a policy store. Action to update a policy in a policy store. Action to get an authorization response based on the parameters described in the authoriza tion request. Action to get an authorization response based on the parameters described in the authoriza tion request where the principal comes from an identity token. IAM policies for Verified Permissions 137 Amazon Verified Permissions User Guide Example IAM policy for permission to the CreatePolicy action: { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "verifiedpermissions:CreatePolicy" ], "Resource": "*" } ] } Identity-based policy examples for Amazon Verified Permissions By default, users and roles don't have permission to create or modify Verified Permissions resources. They also can't perform tasks by using the AWS Management Console, AWS Command Line Interface (AWS CLI), or AWS API. An IAM administrator must create IAM policies that grant users and roles permission to perform actions on the resources that they need. The administrator must then attach those policies for users that require them. To learn how to create an IAM identity-based policy by using these example JSON policy documents, see Creating IAM policies in the IAM User Guide. For details about actions and resource types defined by Verified Permissions, including the format of the ARNs for each of the resource types, see see Actions, resources, and condition keys for Amazon Verified Permissions in the Service Authorization Reference. Topics • Policy best practices • Using the Verified Permissions console • Allow users to view their own permissions Identity-based policy examples 138 Amazon Verified Permissions Policy best practices User Guide Identity-based policies determine whether someone can create, access, or delete Verified Permissions resources in your account. These actions can incur costs for your AWS account. When you create or edit identity-based policies, follow these guidelines and recommendations: • Get started with AWS managed policies and move toward least-privilege permissions – To get started granting permissions to your users and workloads, use the AWS managed policies that grant permissions for many common use cases. They are available in your AWS account. We recommend that you reduce permissions further by defining AWS customer managed policies that are specific to your use cases. |
amazon-verified-permissions-user-guide-051 | amazon-verified-permissions-user-guide.pdf | 51 | Identity-based policies determine whether someone can create, access, or delete Verified Permissions resources in your account. These actions can incur costs for your AWS account. When you create or edit identity-based policies, follow these guidelines and recommendations: • Get started with AWS managed policies and move toward least-privilege permissions – To get started granting permissions to your users and workloads, use the AWS managed policies that grant permissions for many common use cases. They are available in your AWS account. We recommend that you reduce permissions further by defining AWS customer managed policies that are specific to your use cases. For more information, see AWS managed policies or AWS managed policies for job functions in the IAM User Guide. • Apply least-privilege permissions – When you set permissions with IAM policies, grant only the permissions required to perform a task. You do this by defining the actions that can be taken on specific resources under specific conditions, also known as least-privilege permissions. For more information about using IAM to apply permissions, see Policies and permissions in IAM in the IAM User Guide. • Use conditions in IAM policies to further restrict access – You can add a condition to your policies to limit access to actions and resources. For example, you can write a policy condition to specify that all requests must be sent using SSL. You can also use conditions to grant access to service actions if they are used through a specific AWS service, such as AWS CloudFormation. For more information, see IAM JSON policy elements: Condition in the IAM User Guide. • Use IAM Access Analyzer to validate your IAM policies to ensure secure and functional permissions – IAM Access Analyzer validates new and existing policies so that the policies adhere to the IAM policy language (JSON) and IAM best practices. IAM Access Analyzer provides more than 100 policy checks and actionable recommendations to help you author secure and functional policies. For more information, see Validate policies with IAM Access Analyzer in the IAM User Guide. • Require multi-factor authentication (MFA) – If you have a scenario that requires IAM users or a root user in your AWS account, turn on MFA for additional security. To require MFA when API operations are called, add MFA conditions to your policies. For more information, see Secure API access with MFA in the IAM User Guide. For more information about best practices in IAM, see Security best practices in IAM in the IAM User Guide. Identity-based policy examples 139 Amazon Verified Permissions User Guide Using the Verified Permissions console To access the Amazon Verified Permissions console, you must have a minimum set of permissions. These permissions must allow you to list and view details about the Verified Permissions resources in your AWS account. If you create an identity-based policy that is more restrictive than the minimum required permissions, the console won't function as intended for entities (users or roles) with that policy. You don't need to allow minimum console permissions for users that are making calls only to the AWS CLI or the AWS API. Instead, allow access to only the actions that match the API operation that they're trying to perform. To ensure that users and roles can still use the Verified Permissions console, also attach the Verified Permissions ConsoleAccess or ReadOnly AWS managed policy to the entities. For more information, see Adding permissions to a user in the IAM User Guide. Allow users to view their own permissions This example shows how you might create a policy that allows IAM users to view the inline and managed policies that are attached to their user identity. This policy includes permissions to complete this action on the console or programmatically using the AWS CLI or AWS API. { "Version": "2012-10-17", "Statement": [ { "Sid": "ViewOwnUserInfo", "Effect": "Allow", "Action": [ "iam:GetUserPolicy", "iam:ListGroupsForUser", "iam:ListAttachedUserPolicies", "iam:ListUserPolicies", "iam:GetUser" ], "Resource": ["arn:aws:iam::*:user/${aws:username}"] }, { "Sid": "NavigateInConsole", "Effect": "Allow", "Action": [ Identity-based policy examples 140 Amazon Verified Permissions User Guide "iam:GetGroupPolicy", "iam:GetPolicyVersion", "iam:GetPolicy", "iam:ListAttachedGroupPolicies", "iam:ListGroupPolicies", "iam:ListPolicyVersions", "iam:ListPolicies", "iam:ListUsers" ], "Resource": "*" } ] } AWS managed policies for Amazon Verified Permissions To add permissions to users, groups, and roles, it is easier to use AWS managed policies than to write policies yourself. It takes time and expertise to create IAM customer managed policies that provide your team with only the permissions they need. To get started quickly, you can use our AWS managed policies. These policies cover common use cases and are available in your AWS account. For more information about AWS managed policies, see AWS managed policies in the IAM User Guide. AWS services maintain and update AWS managed policies. You can't change the permissions in AWS managed policies. Services occasionally add additional permissions to an AWS managed policy to support new features. This type |
amazon-verified-permissions-user-guide-052 | amazon-verified-permissions-user-guide.pdf | 52 | policies than to write policies yourself. It takes time and expertise to create IAM customer managed policies that provide your team with only the permissions they need. To get started quickly, you can use our AWS managed policies. These policies cover common use cases and are available in your AWS account. For more information about AWS managed policies, see AWS managed policies in the IAM User Guide. AWS services maintain and update AWS managed policies. You can't change the permissions in AWS managed policies. Services occasionally add additional permissions to an AWS managed policy to support new features. This type of update affects all identities (users, groups, and roles) where the policy is attached. Services are most likely to update an AWS managed policy when a new feature is launched or when new operations become available. Services do not remove permissions from an AWS managed policy, so policy updates won't break your existing permissions. Additionally, AWS supports managed policies for job functions that span multiple services. For example, the ReadOnlyAccess AWS managed policy provides read-only access to all AWS services and resources. When a service launches a new feature, AWS adds read-only permissions for new operations and resources. For a list and descriptions of job function policies, see AWS managed policies for job functions in the IAM User Guide. AWS managed policies 141 Amazon Verified Permissions User Guide AWS managed policy: AmazonVerifiedPermissionsFullAccess The AmazonVerifiedPermissionsFullAccess managed policy grants full access to Verified Permissions. To work with Amazon Cognito-based identity sources, you'll need to attach a separate policy, such as the AmazonCognitoReadOnly policy. { "Version": "2012-10-17", "Statement": [ { "Sid": "AccountLevelPermissions", "Effect": "Allow", "Action": [ "verifiedpermissions:CreatePolicyStore", "verifiedpermissions:ListPolicyStores" ], "Resource": "*" }, { "Sid": "PolicyStoreLevelPermissions", "Effect": "Allow", "Action": [ "verifiedpermissions:*" ], "Resource": [ "arn:aws:verifiedpermissions::*:policy-store/*" ] } ] } AWS managed policy: AmazonVerifiedPermissionsReadOnlyAccess The AmazonVerifiedPermissionsReadOnlyAccess managed policy grants read-only access to Verified Permissions. This policy grants access to all read operations of Amazon Verified Permissions, including the authorization query APIs IsAuthorized and IsAuthorizedWithToken. AWS managed policies 142 Amazon Verified Permissions User Guide Note Access to BatchIsAuthorized and BatchIsAuthorizedWithToken are granted automatically when access is granted to IsAuthorized and IsAuthorizedWithToken, respectively. { "Version": "2012-10-17", "Statement": [ { "Sid": "AccountLevelPermissions", "Effect": "Allow", "Action": [ "verifiedpermissions:ListPolicyStores" ], "Resource": "*" }, { "Sid": "PolicyStoreLevelPermissions", "Effect": "Allow", "Action": [ "verifiedpermissions:GetIdentitySource", "verifiedpermissions:GetPolicy", "verifiedpermissions:GetPolicyStore", "verifiedpermissions:GetPolicyTemplate", "verifiedpermissions:GetSchema", "verifiedpermissions:IsAuthorized", "verifiedpermissions:IsAuthorizedWithToken", "verifiedpermissions:ListIdentitySources", "verifiedpermissions:ListPolicies", "verifiedpermissions:ListPolicyTemplates" ], "Resource": [ "arn:aws:verifiedpermissions::*:policy-store/*" ] } ] } AWS managed policies 143 Amazon Verified Permissions User Guide Verified Permissions updates to AWS managed policies View details about updates to AWS managed policies for Verified Permissions since this service began tracking these changes. For automatic alerts about changes to this page, subscribe to the RSS feed on the Verified Permissions Document history page. Change Description Date AmazonVerifiedPermissionsFu llAccess – New policy Verified Permissions added a new policy to allow full access October 11, 2024 to Verified Permissions. AmazonVerifiedPermissionsRe adOnlyAccess – New policy Verified Permissions added a new policy to allow access October 11, 2024 to all read operations of Amazon Verified Permissions, including the authorization query APIs IsAuthorized and IsAuthorizedWithTo ken . Verified Permissions started tracking changes Verified Permissions started tracking changes for its AWS October 11, 2024 managed policies. Troubleshooting Amazon Verified Permissions identity and access Use the following information to help you diagnose and fix common issues that you might encounter when working with Verified Permissions and IAM. Topics • I am not authorized to perform an action in Verified Permissions • I am not authorized to perform iam:PassRole • I want to allow people outside of my AWS account to access my Verified Permissions resources Troubleshooting 144 Amazon Verified Permissions User Guide I am not authorized to perform an action in Verified Permissions If you receive an error that you're not authorized to perform an action, your policies must be updated to allow you to perform the action. The following example error occurs when the mateojackson IAM user tries to use the console to view details about a fictional my-example-widget resource but doesn't have the fictional verifiedpermissions:GetWidget permissions. User: arn:aws:iam::123456789012:user/mateojackson is not authorized to perform: verifiedpermissions:GetWidget on resource: my-example-widget In this case, the policy for the mateojackson user must be updated to allow access to the my- example-widget resource by using the verifiedpermissions:GetWidget action. If you need help, contact your AWS administrator. Your administrator is the person who provided you with your sign-in credentials. I am not authorized to perform iam:PassRole If you receive an error that you're not authorized to perform the iam:PassRole action, your policies must be updated to allow you to pass a role to Verified Permissions. Some AWS services allow you to pass an existing role to that service instead of creating a new service role or service-linked role. To do this, you must have permissions to pass the role to the service. The |
amazon-verified-permissions-user-guide-053 | amazon-verified-permissions-user-guide.pdf | 53 | resource by using the verifiedpermissions:GetWidget action. If you need help, contact your AWS administrator. Your administrator is the person who provided you with your sign-in credentials. I am not authorized to perform iam:PassRole If you receive an error that you're not authorized to perform the iam:PassRole action, your policies must be updated to allow you to pass a role to Verified Permissions. Some AWS services allow you to pass an existing role to that service instead of creating a new service role or service-linked role. To do this, you must have permissions to pass the role to the service. The following example error occurs when an IAM user named marymajor tries to use the console to perform an action in Verified Permissions. However, the action requires the service to have permissions that are granted by a service role. Mary does not have permissions to pass the role to the service. User: arn:aws:iam::123456789012:user/marymajor is not authorized to perform: iam:PassRole In this case, Mary's policies must be updated to allow her to perform the iam:PassRole action. If you need help, contact your AWS administrator. Your administrator is the person who provided you with your sign-in credentials. Troubleshooting 145 Amazon Verified Permissions User Guide I want to allow people outside of my AWS account to access my Verified Permissions resources You can create a role that users in other accounts or people outside of your organization can use to access your resources. You can specify who is trusted to assume the role. For services that support resource-based policies or access control lists (ACLs), you can use those policies to grant people access to your resources. To learn more, consult the following: • To learn whether Verified Permissions supports these features, see How Amazon Verified Permissions works with IAM. • To learn how to provide access to your resources across AWS accounts that you own, see Providing access to an IAM user in another AWS account that you own in the IAM User Guide. • To learn how to provide access to your resources to third-party AWS accounts, see Providing access to AWS accounts owned by third parties in the IAM User Guide. • To learn how to provide access through identity federation, see Providing access to externally authenticated users (identity federation) in the IAM User Guide. • To learn the difference between using roles and resource-based policies for cross-account access, see Cross account resource access in IAM in the IAM User Guide. Compliance validation for Amazon Verified Permissions To learn whether an AWS service is within the scope of specific compliance programs, see AWS services in Scope by Compliance Program and choose the compliance program that you are interested in. For general information, see AWS Compliance Programs. You can download third-party audit reports using AWS Artifact. For more information, see Downloading Reports in AWS Artifact. Your compliance responsibility when using AWS services is determined by the sensitivity of your data, your company's compliance objectives, and applicable laws and regulations. AWS provides the following resources to help with compliance: • Security Compliance & Governance – These solution implementation guides discuss architectural considerations and provide steps for deploying security and compliance features. Compliance validation 146 Amazon Verified Permissions User Guide • HIPAA Eligible Services Reference – Lists HIPAA eligible services. Not all AWS services are HIPAA eligible. • AWS Compliance Resources – This collection of workbooks and guides might apply to your industry and location. • AWS Customer Compliance Guides – Understand the shared responsibility model through the lens of compliance. The guides summarize the best practices for securing AWS services and map the guidance to security controls across multiple frameworks (including National Institute of Standards and Technology (NIST), Payment Card Industry Security Standards Council (PCI), and International Organization for Standardization (ISO)). • Evaluating Resources with Rules in the AWS Config Developer Guide – The AWS Config service assesses how well your resource configurations comply with internal practices, industry guidelines, and regulations. • AWS Security Hub – This AWS service provides a comprehensive view of your security state within AWS. Security Hub uses security controls to evaluate your AWS resources and to check your compliance against security industry standards and best practices. For a list of supported services and controls, see Security Hub controls reference. • Amazon GuardDuty – This AWS service detects potential threats to your AWS accounts, workloads, containers, and data by monitoring your environment for suspicious and malicious activities. GuardDuty can help you address various compliance requirements, like PCI DSS, by meeting intrusion detection requirements mandated by certain compliance frameworks. • AWS Audit Manager – This AWS service helps you continuously audit your AWS usage to simplify how you manage risk and compliance with regulations and industry standards. Resilience in Amazon Verified Permissions The AWS global infrastructure is built around AWS Regions |
amazon-verified-permissions-user-guide-054 | amazon-verified-permissions-user-guide.pdf | 54 | of supported services and controls, see Security Hub controls reference. • Amazon GuardDuty – This AWS service detects potential threats to your AWS accounts, workloads, containers, and data by monitoring your environment for suspicious and malicious activities. GuardDuty can help you address various compliance requirements, like PCI DSS, by meeting intrusion detection requirements mandated by certain compliance frameworks. • AWS Audit Manager – This AWS service helps you continuously audit your AWS usage to simplify how you manage risk and compliance with regulations and industry standards. Resilience in Amazon Verified Permissions The AWS global infrastructure is built around AWS Regions and Availability Zones. AWS Regions provide multiple physically separated and isolated Availability Zones, which are connected with low-latency, high-throughput, and highly redundant networking. With Availability Zones, you can design and operate applications and databases that automatically fail over between zones without interruption. Availability Zones are more highly available, fault tolerant, and scalable than traditional single or multiple data center infrastructures. When you create a Verified Permissions policy store , it is created within an individual AWS Region, and is automatically replicated across the data centers that make up that Region's Availability Zones. At this time, Verified Permissions doesn't support any cross-region replication. Resilience 147 Amazon Verified Permissions User Guide For more information about AWS Regions and Availability Zones, see AWS Global Infrastructure. Resilience 148 Amazon Verified Permissions User Guide Monitoring Amazon Verified Permissions API calls Monitoring is an important part of maintaining the reliability, availability, and performance of Amazon Verified Permissions and your other AWS solutions. AWS provides the following tools to monitor Verified Permissions, report when something is wrong, and take automatic actions when appropriate: • AWS CloudTrail captures API calls and related events made by or on behalf of your AWS account and delivers the log files to an Amazon S3 bucket that you specify. You can identify which users and accounts called AWS, the source IP address from which the calls were made, and when the calls occurred. For more information, see the AWS CloudTrail User Guide. For more information about monitoring Verified Permissions with CloudTrail, see Logging Amazon Verified Permissions API calls using AWS CloudTrail. Logging Amazon Verified Permissions API calls using AWS CloudTrail Amazon Verified Permissions is integrated with AWS CloudTrail, a service that provides a record of actions taken by a user, role, or an AWS service in Verified Permissions. CloudTrail captures all API calls for Verified Permissions as events. The calls captured include calls from the Verified Permissions console and code calls to the Verified Permissions API operations. If you create a trail, you can enable continuous delivery of CloudTrail events to an Amazon S3 bucket, including events for Verified Permissions. If you don't configure a trail, you can still view the most recent management action events in the CloudTrail console in Event history, but not events for API calls such as isAuthorized. Using the information collected by CloudTrail, you can determine the request that was made to Verified Permissions, the IP address from which the request was made, who made the request, when it was made, and additional details. To learn more about CloudTrail, see the AWS CloudTrail User Guide. Verified Permissions information in CloudTrail CloudTrail is enabled on your AWS account when you create the account. When activity occurs in Verified Permissions, that activity is recorded in a CloudTrail event along with other AWS service events in Event history. You can view, search, and download recent events in your AWS account. For more information, see Viewing events with CloudTrail Event history. CloudTrail logs 149 Amazon Verified Permissions User Guide For an ongoing record of events in your AWS account, including events for Verified Permissions, create a trail. A trail enables CloudTrail to deliver log files to an Amazon S3 bucket. By default, when you create a trail in the console, the trail applies to all AWS Regions. The trail logs events from all Regions in the AWS partition and delivers the log files to the Amazon S3 bucket that you specify. Additionally, you can configure other AWS services to further analyze and act upon the event data collected in CloudTrail logs. For more information, see the following: • Overview for creating a trail • CloudTrail supported services and integrations • Configuring Amazon SNS notifications for CloudTrail • Receiving CloudTrail log files from multiple regions and Receiving CloudTrail log files from multiple accounts All Verified Permissions actions are logged by CloudTrail and are documented in the Amazon Verified Permissions API Reference Guide. For example, calls to the CreateIdentitySource, DeletePolicy, and ListPolicyStores actions generate entries in the CloudTrail log files. Every event or log entry contains information about who generated the request. The identity information helps you determine the following: • Whether the request was made with root or AWS Identity and Access |
amazon-verified-permissions-user-guide-055 | amazon-verified-permissions-user-guide.pdf | 55 | a trail • CloudTrail supported services and integrations • Configuring Amazon SNS notifications for CloudTrail • Receiving CloudTrail log files from multiple regions and Receiving CloudTrail log files from multiple accounts All Verified Permissions actions are logged by CloudTrail and are documented in the Amazon Verified Permissions API Reference Guide. For example, calls to the CreateIdentitySource, DeletePolicy, and ListPolicyStores actions generate entries in the CloudTrail log files. Every event or log entry contains information about who generated the request. The identity information helps you determine the following: • Whether the request was made with root or AWS Identity and Access Management (IAM) user credentials. • Whether the request was made with temporary security credentials for a role or federated user. • Whether the request was made by another AWS service. For more information, see the CloudTrail userIdentity element. Data events like IsAuthorized and IsAuthorizedWithToken are not logged by default when you create a trail or event data store. To record CloudTrail data events, you must explicitly add the supported resources or resource types for which you want to collect activity. For more information, see Data events in the AWS CloudTrail User Guide. Understanding Verified Permissions log file entries A trail is a configuration that enables delivery of events as log files to an Amazon S3 bucket that you specify. CloudTrail log files contain one or more log entries. An event represents a single request from any source and includes information about the requested action, the date and time of Understanding Verified Permissions log file entries 150 Amazon Verified Permissions User Guide the action, request parameters, and so on. CloudTrail log files aren't an ordered stack trace of the public API calls, so they don't appear in any specific order. For authorization API calls, the response elements, such as the decision, are included under additionalEventData rather than responseElements. Topics • IsAuthorized • BatchIsAuthorized • CreatePolicyStore • ListPolicyStores • DeletePolicyStore • PutSchema • GetSchema • CreatePolicyTemplate • DeletePolicyTemplate • CreatePolicy • GetPolicy • CreateIdentitySource • GetIdentitySource • ListIdentitySources • DeleteIdentitySource Note Some fields have been redacted from the examples for data privacy. IsAuthorized { "eventVersion": "1.08", "userIdentity": { "type": "AssumedRole", "principalId": "EXAMPLE_PRINCIPAL_ID", Understanding Verified Permissions log file entries 151 Amazon Verified Permissions User Guide "arn": "arn:aws:iam::123456789012:role/ExampleRole", "accountId": "123456789012", "accessKeyId": "AKIAIOSFODNN7EXAMPLE" }, "eventTime": "2023-11-20T22:55:03Z", "eventSource": "verifiedpermissions.amazonaws.com", "eventName": "IsAuthorized", "awsRegion": "us-west-2", "sourceIPAddress": "203.0.113.0", "userAgent": "aws-cli/2.11.18 Python/3.11.3 Linux/5.4.241-160.348.amzn2int.x86_64 exe/x86_64.amzn.2 prompt/off command/verifiedpermissions.is-authorized", "requestParameters": { "principal": { "entityType": "PhotoFlash::User", "entityId": "alice" }, "action": { "actionType": "PhotoFlash::Action", "actionId": "ViewPhoto" }, "resource": { "entityType": "PhotoFlash::Photo", "entityId": "VacationPhoto94.jpg" }, "policyStoreId": "PSEXAMPLEabcdefg111111" }, "responseElements": null, "additionalEventData": { "decision": "ALLOW" }, "requestID": "346c4b6a-d12f-46b6-bc06-6c857bd3b28e", "eventID": "8a4fed32-9605-45dd-a09a-5ebbf0715bbc", "readOnly": true, "resources": [ { "accountId": "123456789012", "type": "AWS::VerifiedPermissions::PolicyStore", "ARN": "arn:aws:verifiedpermissions::123456789012:policy-store/ PSEXAMPLEabcdefg111111" } ], "eventType": "AwsApiCall", "managementEvent": false, "recipientAccountId": "123456789012", Understanding Verified Permissions log file entries 152 Amazon Verified Permissions "eventCategory": "Data" } BatchIsAuthorized { "eventVersion": "1.08", "userIdentity": { "type": "AssumedRole", User Guide "principalId": "EXAMPLE_PRINCIPAL_ID", "arn": "arn:aws:iam::123456789012:role/ExampleRole", "accountId": "123456789012", "accessKeyId": "AKIAIOSFODNN7EXAMPLE" }, "eventTime": "2023-11-20T23:02:33Z", "eventSource": "verifiedpermissions.amazonaws.com", "eventName": "BatchIsAuthorized", "awsRegion": "us-west-2", "sourceIPAddress": "203.0.113.0", "userAgent": "aws-cli/2.11.18 Python/3.11.3 Linux/5.4.241-160.348.amzn2int.x86_64 exe/x86_64.amzn.2 prompt/off command/verifiedpermissions.is-authorized", "requestParameters": { "requests": [ { "principal": { "entityType": "PhotoFlash::User", "entityId": "alice" }, "action": { "actionType": "PhotoFlash::Action", "actionId": "ViewPhoto" }, "resource": { "entityType": "PhotoFlash::Photo", "entityId": "VacationPhoto94.jpg" } }, { "principal": { "entityType": "PhotoFlash::User", "entityId": "annalisa" }, "action": { Understanding Verified Permissions log file entries 153 Amazon Verified Permissions User Guide "actionType": "PhotoFlash::Action", "actionId": "DeletePhoto" }, "resource": { "entityType": "PhotoFlash::Photo", "entityId": "VacationPhoto94.jpg" } } ], "policyStoreId": "PSEXAMPLEabcdefg111111" }, "responseElements": null, "additionalEventData": { "results": [ { "request": { "principal": { "entityType": "PhotoFlash::User", "entityId": "alice" }, "action": { "actionType": "PhotoFlash::Action", "actionId": "ViewPhoto" }, "resource": { "entityType": "PhotoFlash::Photo", "entityId": "VacationPhoto94.jpg" } }, "decision": "ALLOW" }, { "request": { "principal": { "entityType": "PhotoFlash::User", "entityId": "annalisa" }, "action": { "actionType": "PhotoFlash::Action", "actionId": "DeletePhoto" }, "resource": { "entityType": "PhotoFlash::Photo", "entityId": "VacationPhoto94.jpg" Understanding Verified Permissions log file entries 154 Amazon Verified Permissions User Guide } }, "decision": "DENY" } ] }, "requestID": "a8a5caf3-78bd-4139-924c-7101a8339c3b", "eventID": "7d81232f-f3d1-4102-b9c9-15157c70487b", "readOnly": true, "resources": [ { "accountId": "123456789012", "type": "AWS::VerifiedPermissions::PolicyStore", "ARN": "arn:aws:verifiedpermissions::123456789012:policy-store/ PSEXAMPLEabcdefg111111" } ], "eventType": "AwsApiCall", "managementEvent": false, "recipientAccountId": "123456789012", "eventCategory": "Data" } CreatePolicyStore { "eventVersion": "1.08", "userIdentity": { "type": "AssumedRole", "principalId": "EXAMPLE_PRINCIPAL_ID", "arn": "arn:aws:iam::123456789012:role/ExampleRole", "accountId": "123456789012", "accessKeyId": "AKIAIOSFODNN7EXAMPLE" }, "eventTime": "2023-05-22T07:43:33Z", "eventSource": "verifiedpermissions.amazonaws.com", "eventName": "CreatePolicyStore", "awsRegion": "us-west-2", "sourceIPAddress": "203.0.113.0", "userAgent": "aws-sdk-rust/0.55.2 os/linux lang/rust/1.69.0", "requestParameters": { "clientToken": "a1b2c3d4-e5f6-a1b2-c3d4-TOKEN1111111", "validationSettings": { Understanding Verified Permissions log file entries 155 User Guide Amazon Verified Permissions "mode": "OFF" } }, "responseElements": { "policyStoreId": "PSEXAMPLEabcdefg111111", "arn": "arn:aws:verifiedpermissions::123456789012:policy-store/ PSEXAMPLEabcdefg111111", "createdDate": "2023-05-22T07:43:33.962794Z", "lastUpdatedDate": "2023-05-22T07:43:33.962794Z" }, "requestID": "1dd9360e-e2dc-4554-ab65-b46d2cf45c29", "eventID": "b6edaeee-3584-4b4e-a48e-311de46d7532", "readOnly": false, "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "123456789012", "eventCategory": "Management" } ListPolicyStores { "eventVersion": "1.08", "userIdentity": { "type": "AssumedRole", "principalId": "EXAMPLE_PRINCIPAL_ID", "arn": "arn:aws:iam::123456789012:role/ExampleRole", "accountId": "123456789012", "accessKeyId": "AKIAIOSFODNN7EXAMPLE" }, "eventTime": "2023-05-22T07:43:33Z", "eventSource": "verifiedpermissions.amazonaws.com", "eventName": "ListPolicyStores", "awsRegion": "us-west-2", "sourceIPAddress": "203.0.113.0", "userAgent": "aws-sdk-rust/0.55.2 os/linux lang/rust/1.69.0", "requestParameters": { "maxResults": 10 }, "responseElements": null, "requestID": "5ef238db-9f87-4f37-ab7b-6cf0ba5df891", "eventID": "b0430fb0-12c3-4cca-8d05-84c37f99c51f", "readOnly": true, Understanding Verified Permissions log file |
amazon-verified-permissions-user-guide-056 | amazon-verified-permissions-user-guide.pdf | 56 | os/linux lang/rust/1.69.0", "requestParameters": { "clientToken": "a1b2c3d4-e5f6-a1b2-c3d4-TOKEN1111111", "validationSettings": { Understanding Verified Permissions log file entries 155 User Guide Amazon Verified Permissions "mode": "OFF" } }, "responseElements": { "policyStoreId": "PSEXAMPLEabcdefg111111", "arn": "arn:aws:verifiedpermissions::123456789012:policy-store/ PSEXAMPLEabcdefg111111", "createdDate": "2023-05-22T07:43:33.962794Z", "lastUpdatedDate": "2023-05-22T07:43:33.962794Z" }, "requestID": "1dd9360e-e2dc-4554-ab65-b46d2cf45c29", "eventID": "b6edaeee-3584-4b4e-a48e-311de46d7532", "readOnly": false, "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "123456789012", "eventCategory": "Management" } ListPolicyStores { "eventVersion": "1.08", "userIdentity": { "type": "AssumedRole", "principalId": "EXAMPLE_PRINCIPAL_ID", "arn": "arn:aws:iam::123456789012:role/ExampleRole", "accountId": "123456789012", "accessKeyId": "AKIAIOSFODNN7EXAMPLE" }, "eventTime": "2023-05-22T07:43:33Z", "eventSource": "verifiedpermissions.amazonaws.com", "eventName": "ListPolicyStores", "awsRegion": "us-west-2", "sourceIPAddress": "203.0.113.0", "userAgent": "aws-sdk-rust/0.55.2 os/linux lang/rust/1.69.0", "requestParameters": { "maxResults": 10 }, "responseElements": null, "requestID": "5ef238db-9f87-4f37-ab7b-6cf0ba5df891", "eventID": "b0430fb0-12c3-4cca-8d05-84c37f99c51f", "readOnly": true, Understanding Verified Permissions log file entries 156 Amazon Verified Permissions User Guide "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "123456789012", "eventCategory": "Management" } DeletePolicyStore { "eventVersion": "1.08", "userIdentity": { "type": "AssumedRole", "principalId": "EXAMPLE_PRINCIPAL_ID", "arn": "arn:aws:iam::123456789012:role/ExampleRole", "accountId": "123456789012", "accessKeyId": "AKIAIOSFODNN7EXAMPLE" }, "eventTime": "2023-05-22T07:43:32Z", "eventSource": "verifiedpermissions.amazonaws.com", "eventName": "DeletePolicyStore", "awsRegion": "us-west-2", "sourceIPAddress": "203.0.113.0", "userAgent": "aws-sdk-rust/0.55.2 os/linux lang/rust/1.69.0", "requestParameters": { "policyStoreId": "PSEXAMPLEabcdefg111111" }, "responseElements": null, "requestID": "1368e8f9-130d-45a5-b96d-99097ca3077f", "eventID": "ac482022-b2f6-4069-879a-dd509123d8d7", "readOnly": false, "resources": [ { "accountId": "123456789012", "type": "AWS::VerifiedPermissions::PolicyStore", "arn": "arn:aws:verifiedpermissions::123456789012:policy-store/ PSEXAMPLEabcdefg111111" } ], "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "123456789012", "eventCategory": "Management" } Understanding Verified Permissions log file entries 157 User Guide Amazon Verified Permissions PutSchema { "eventVersion": "1.08", "userIdentity": { "type": "AssumedRole", "principalId": "EXAMPLE_PRINCIPAL_ID", "arn": "arn:aws:iam::123456789012:role/ExampleRole", "accountId": "123456789012", "accessKeyId": "AKIAIOSFODNN7EXAMPLE" }, "eventTime": "2023-05-16T12:58:57Z", "eventSource": "verifiedpermissions.amazonaws.com", "eventName": "PutSchema", "awsRegion": "us-west-2", "sourceIPAddress": "203.0.113.0", "userAgent": "aws-sdk-rust/0.55.2 os/linux lang/rust/1.69.0", "requestParameters": { "policyStoreId": "PSEXAMPLEabcdefg111111" }, "responseElements": { "lastUpdatedDate": "2023-05-16T12:58:57.513442Z", "namespaces": "[some_namespace]", "createdDate": "2023-05-16T12:58:57.513442Z", "policyStoreId": "PSEXAMPLEabcdefg111111", }, "requestID": "631fbfa1-a959-4988-b9f8-f1a43ff5df0d", "eventID": "7cd0c677-733f-4602-bc03-248bae581fe5", "readOnly": false, "resources": [ { "accountId": "123456789012", "type": "AWS::VerifiedPermissions::PolicyStore", "ARN": "arn:aws:verifiedpermissions::123456789012:policy-store/ PSEXAMPLEabcdefg111111" } ], "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "123456789012", "eventCategory": "Management" } Understanding Verified Permissions log file entries 158 User Guide Amazon Verified Permissions GetSchema { "eventVersion": "1.08", "userIdentity": { "type": "AssumedRole", "principalId": "EXAMPLE_PRINCIPAL_ID", "arn": "arn:aws:iam::222222222222:role/ExampleRole", "accountId": "222222222222", "accessKeyId": "AKIAIOSFODNN7EXAMPLE" }, "eventTime": "2023-05-25T01:12:07Z", "eventSource": "verifiedpermissions.amazonaws.com", "eventName": "GetSchema", "awsRegion": "us-west-2", "sourceIPAddress": "203.0.113.0", "userAgent": "aws-sdk-rust/0.55.2 os/linux lang/rust/1.69.0", "requestParameters": { "policyStoreId": "PSEXAMPLEabcdefg111111" }, "responseElements": null, "requestID": "a1f4d4cd-6156-480a-a9b8-e85a71dcc7c2", "eventID": "0b3b8e3d-155c-46f3-a303-7e9e8b5f606b", "readOnly": true, "resources": [ { "accountId": "222222222222", "type": "AWS::VerifiedPermissions::PolicyStore", "ARN": "arn:aws:verifiedpermissions::222222222222:policy-store/ PSEXAMPLEabcdefg111111" } ], "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "222222222222", "eventCategory": "Management" } CreatePolicyTemplate { "eventVersion": "1.08", "userIdentity": { Understanding Verified Permissions log file entries 159 Amazon Verified Permissions "type": "AssumedRole", User Guide "principalId": "EXAMPLE_PRINCIPAL_ID", "arn": "arn:aws:iam::123456789012:role/ExampleRole", "accountId": "123456789012", "accessKeyId": "AKIAIOSFODNN7EXAMPLE" }, "eventTime": "2023-05-16T13:00:24Z", "eventSource": "verifiedpermissions.amazonaws.com", "eventName": "CreatePolicyTemplate", "awsRegion": "us-west-2", "sourceIPAddress": "203.0.113.0", "userAgent": "aws-sdk-rust/0.55.2 os/linux lang/rust/1.69.0", "requestParameters": { "policyStoreId": "PSEXAMPLEabcdefg111111" }, "responseElements": { "lastUpdatedDate": "2023-05-16T13:00:23.444404Z", "createdDate": "2023-05-16T13:00:23.444404Z", "policyTemplateId": "PTEXAMPLEabcdefg111111", "policyStoreId": "PSEXAMPLEabcdefg111111", }, "requestID": "73953bda-af5e-4854-afe2-7660b492a6d0", "eventID": "7425de77-ed84-4f91-a4b9-b669181cc57b", "readOnly": false, "resources": [ { "accountId": "123456789012", "type": "AWS::VerifiedPermissions::PolicyStore", "arn": "arn:aws:verifiedpermissions::123456789012:policy-store/ PSEXAMPLEabcdefg111111" } ], "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "123456789012", "eventCategory": "Management" } DeletePolicyTemplate { "eventVersion": "1.08", "userIdentity": { Understanding Verified Permissions log file entries 160 User Guide Amazon Verified Permissions "type": "AssumedRole", "principalId": "EXAMPLE_PRINCIPAL_ID", "arn": "arn:aws:iam::222222222222:role/ExampleRole", "accountId": "222222222222", "accessKeyId": "AKIAIOSFODNN7EXAMPLE" }, "eventTime": "2023-05-25T01:11:48Z", "eventSource": "verifiedpermissions.amazonaws.com", "eventName": "DeletePolicyTemplate", "awsRegion": "us-west-2", "sourceIPAddress": "203.0.113.0", "userAgent": "aws-sdk-rust/0.55.2 os/linux lang/rust/1.69.0", "requestParameters": { "policyStoreId": "PSEXAMPLEabcdefg111111", "policyTemplateId": "PTEXAMPLEabcdefg111111" }, "responseElements": null, "requestID": "5ff0f22e-6bbd-4b85-a400-4fb74aa05dc6", "eventID": "c0e0c689-369e-4e95-a9cd-8de113d47ffa", "readOnly": false, "resources": [ { "accountId": "222222222222", "type": "AWS::VerifiedPermissions::PolicyStore", "ARN": "arn:aws:verifiedpermissions::222222222222:policy-store/ PSEXAMPLEabcdefg111111" } ], "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "222222222222", "eventCategory": "Management" } CreatePolicy { "eventVersion": "1.08", "userIdentity": { "type": "AssumedRole", "principalId": "EXAMPLE_PRINCIPAL_ID", "arn": "arn:aws:iam::123456789012:role/ExampleRole", "accountId": "123456789012", Understanding Verified Permissions log file entries 161 Amazon Verified Permissions User Guide "accessKeyId": "AKIAIOSFODNN7EXAMPLE" }, "eventTime": "2023-05-22T07:42:30Z", "eventSource": "verifiedpermissions.amazonaws.com", "eventName": "CreatePolicy", "awsRegion": "us-west-2", "sourceIPAddress": "203.0.113.0", "userAgent": "aws-sdk-rust/0.55.2 os/linux lang/rust/1.69.0", "requestParameters": { "clientToken": "a1b2c3d4-e5f6-a1b2-c3d4-TOKEN1111111", "policyStoreId": "PSEXAMPLEabcdefg111111" }, "responseElements": { "policyStoreId": "PSEXAMPLEabcdefg111111", "policyId": "SPEXAMPLEabcdefg111111", "policyType": "STATIC", "principal": { "entityType": "PhotoApp::Role", "entityId": "PhotoJudge" }, "resource": { "entityType": "PhotoApp::Application", "entityId": "PhotoApp" }, "lastUpdatedDate": "2023-05-22T07:42:30.70852Z", "createdDate": "2023-05-22T07:42:30.70852Z" }, "requestID": "93ffa151-3841-4960-9af6-30a7f817ef93", "eventID": "30ab405f-3dff-43ff-8af9-f513829e8bde", "readOnly": false, "resources": [ { "accountId": "123456789012", "type": "AWS::VerifiedPermissions::PolicyStore", "arn": "arn:aws:verifiedpermissions::123456789012:policy-store/ PSEXAMPLEabcdefg111111" } ], "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "123456789012", "eventCategory": "Management" } Understanding Verified Permissions log file entries 162 Amazon Verified Permissions User Guide GetPolicy { "eventVersion": "1.08", "userIdentity": { "type": "AssumedRole", "principalId": "EXAMPLE_PRINCIPAL_ID", "arn": "arn:aws:iam::123456789012:role/ExampleRole", "accountId": "123456789012", "accessKeyId": "AKIAIOSFODNN7EXAMPLE" }, "eventTime": "2023-05-22T07:43:29Z", "eventSource": "verifiedpermissions.amazonaws.com", "eventName": "GetPolicy", "awsRegion": "us-west-2", "sourceIPAddress": "203.0.113.0", "userAgent": "aws-sdk-rust/0.55.2 os/linux lang/rust/1.69.0", "requestParameters": { "policyStoreId": "PSEXAMPLEabcdefg111111", "policyId": "SPEXAMPLEabcdefg111111" }, "responseElements": null, "requestID": "23022a9e-2f5c-4dac-b653-59e6987f2fac", "eventID": "9b4d5037-bafa-4d57-b197-f46af83fc684", "readOnly": true, "resources": [ { "accountId": "123456789012", "type": "AWS::VerifiedPermissions::PolicyStore", "arn": "arn:aws:verifiedpermissions::123456789012:policy-store/ PSEXAMPLEabcdefg111111" } ], "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "123456789012", "eventCategory": "Management" } CreateIdentitySource { "eventVersion": "1.08", Understanding Verified Permissions log file entries 163 User Guide Amazon Verified Permissions "userIdentity": { "type": "AssumedRole", "principalId": "EXAMPLE_PRINCIPAL_ID", "arn": "arn:aws:iam::333333333333:role/ExampleRole", "accountId": "333333333333", "accessKeyId": "AKIAIOSFODNN7EXAMPLE" }, "eventTime": "2023-05-19T01:27:44Z", "eventSource": "verifiedpermissions.amazonaws.com", "eventName": "CreateIdentitySource", "awsRegion": "us-west-2", "sourceIPAddress": "203.0.113.0", "userAgent": "aws-sdk-rust/0.55.2 os/linux lang/rust/1.69.0", "requestParameters": { "clientToken": "a1b2c3d4-e5f6-a1b2-c3d4-TOKEN1111111", "configuration": { "cognitoUserPoolConfiguration": { "userPoolArn": "arn:aws:cognito-idp:000011112222:us-east-1:userpool/us- east-1_aaaaaaaaaa" } }, "policyStoreId": "PSEXAMPLEabcdefg111111", "principalEntityType": "User" }, "responseElements": { "createdDate": "2023-07-14T15:05:01.599534Z", "identitySourceId": "ISEXAMPLEabcdefg111111", "lastUpdatedDate": "2023-07-14T15:05:01.599534Z", "policyStoreId": "PSEXAMPLEabcdefg111111" }, "requestID": "afcc1e67-d5a4-4a9b-a74c-cdc2f719391c", "eventID": "f13a41dc-4496-4517-aeb8-a389eb379860", "readOnly": false, "resources": [ { "accountId": "333333333333", "type": "AWS::VerifiedPermissions::PolicyStore", "arn": "arn:aws:verifiedpermissions::333333333333:policy-store/ PSEXAMPLEabcdefg111111" } ], "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "333333333333", Understanding Verified Permissions log file entries 164 Amazon Verified Permissions User Guide |
amazon-verified-permissions-user-guide-057 | amazon-verified-permissions-user-guide.pdf | 57 | file entries 163 User Guide Amazon Verified Permissions "userIdentity": { "type": "AssumedRole", "principalId": "EXAMPLE_PRINCIPAL_ID", "arn": "arn:aws:iam::333333333333:role/ExampleRole", "accountId": "333333333333", "accessKeyId": "AKIAIOSFODNN7EXAMPLE" }, "eventTime": "2023-05-19T01:27:44Z", "eventSource": "verifiedpermissions.amazonaws.com", "eventName": "CreateIdentitySource", "awsRegion": "us-west-2", "sourceIPAddress": "203.0.113.0", "userAgent": "aws-sdk-rust/0.55.2 os/linux lang/rust/1.69.0", "requestParameters": { "clientToken": "a1b2c3d4-e5f6-a1b2-c3d4-TOKEN1111111", "configuration": { "cognitoUserPoolConfiguration": { "userPoolArn": "arn:aws:cognito-idp:000011112222:us-east-1:userpool/us- east-1_aaaaaaaaaa" } }, "policyStoreId": "PSEXAMPLEabcdefg111111", "principalEntityType": "User" }, "responseElements": { "createdDate": "2023-07-14T15:05:01.599534Z", "identitySourceId": "ISEXAMPLEabcdefg111111", "lastUpdatedDate": "2023-07-14T15:05:01.599534Z", "policyStoreId": "PSEXAMPLEabcdefg111111" }, "requestID": "afcc1e67-d5a4-4a9b-a74c-cdc2f719391c", "eventID": "f13a41dc-4496-4517-aeb8-a389eb379860", "readOnly": false, "resources": [ { "accountId": "333333333333", "type": "AWS::VerifiedPermissions::PolicyStore", "arn": "arn:aws:verifiedpermissions::333333333333:policy-store/ PSEXAMPLEabcdefg111111" } ], "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "333333333333", Understanding Verified Permissions log file entries 164 Amazon Verified Permissions User Guide "eventCategory": "Management" } GetIdentitySource { "eventVersion": "1.08", "userIdentity": { "type": "AssumedRole", "principalId": "EXAMPLE_PRINCIPAL_ID", "arn": "arn:aws:iam::333333333333:role/ExampleRole", "accountId": "333333333333", "accessKeyId": "AKIAIOSFODNN7EXAMPLE" }, "eventTime": "2023-05-24T19:55:31Z", "eventSource": "verifiedpermissions.amazonaws.com", "eventName": "GetIdentitySource", "awsRegion": "us-west-2", "sourceIPAddress": "203.0.113.0", "userAgent": "aws-sdk-rust/0.55.2 os/linux lang/rust/1.69.0", "requestParameters": { "identitySourceId": "ISEXAMPLEabcdefg111111", "policyStoreId": "PSEXAMPLEabcdefg111111" }, "responseElements": null, "requestID": "7a6ecf79-c489-4516-bb57-9ded970279c9", "eventID": "fa158e6c-f705-4a15-a731-2cdb4bd9a427", "readOnly": true, "resources": [ { "accountId": "333333333333", "type": "AWS::VerifiedPermissions::PolicyStore", "arn": "arn:aws:verifiedpermissions::333333333333:policy-store/ PSEXAMPLEabcdefg111111" } ], "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "333333333333", "eventCategory": "Management" } Understanding Verified Permissions log file entries 165 User Guide Amazon Verified Permissions ListIdentitySources { "eventVersion": "1.08", "userIdentity": { "type": "AssumedRole", "principalId": "EXAMPLE_PRINCIPAL_ID", "arn": "arn:aws:iam::333333333333:role/ExampleRole", "accountId": "333333333333", "accessKeyId": "AKIAIOSFODNN7EXAMPLE" }, "eventTime": "2023-05-24T20:05:32Z", "eventSource": "verifiedpermissions.amazonaws.com", "eventName": "ListIdentitySources", "awsRegion": "us-west-2", "sourceIPAddress": "203.0.113.0", "userAgent": "aws-sdk-rust/0.55.2 os/linux lang/rust/1.69.0", "requestParameters": { "policyStoreId": "PSEXAMPLEabcdefg111111" }, "responseElements": null, "requestID": "95d2a7bc-7e9a-4efe-918e-97e558aacaf7", "eventID": "d3dc53f6-1432-40c8-9d1d-b9eeb75c6193", "readOnly": true, "resources": [ { "accountId": "333333333333", "type": "AWS::VerifiedPermissions::PolicyStore", "arn": "arn:aws:verifiedpermissions::333333333333:policy-store/ PSEXAMPLEabcdefg111111" } ], "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "333333333333", "eventCategory": "Management" } DeleteIdentitySource { "eventVersion": "1.08", "userIdentity": { Understanding Verified Permissions log file entries 166 User Guide Amazon Verified Permissions "type": "AssumedRole", "principalId": "EXAMPLE_PRINCIPAL_ID", "arn": "arn:aws:iam::333333333333:role/ExampleRole", "accountId": "333333333333", "accessKeyId": "AKIAIOSFODNN7EXAMPLE" }, "eventTime": "2023-05-24T19:55:32Z", "eventSource": "verifiedpermissions.amazonaws.com", "eventName": "DeleteIdentitySource", "awsRegion": "us-west-2", "sourceIPAddress": "203.0.113.0", "userAgent": "aws-sdk-rust/0.55.2 os/linux lang/rust/1.69.0", "requestParameters": { "identitySourceId": "ISEXAMPLEabcdefg111111", "policyStoreId": "PSEXAMPLEabcdefg111111" }, "responseElements": null, "requestID": "d554d964-0957-4834-a421-c417bd293086", "eventID": "fe4d867c-88ee-4e5d-8d30-2fbc208c9260", "readOnly": false, "resources": [ { "accountId": "333333333333", "type": "AWS::VerifiedPermissions::PolicyStore", "arn": "arn:aws:verifiedpermissions::333333333333:policy-store/ PSEXAMPLEabcdefg111111" } ], "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "333333333333", "eventCategory": "Management" } Understanding Verified Permissions log file entries 167 Amazon Verified Permissions User Guide Creating Amazon Verified Permissions resources with AWS CloudFormation Amazon Verified Permissions is integrated with AWS CloudFormation, a service that helps you to model and set up your AWS resources so that you can spend less time creating and managing your resources and infrastructure. You create a template that describes all the AWS resources that you want (such as policy stores), and AWS CloudFormation provisions and configures those resources for you. When you use AWS CloudFormation, you can reuse your template to set up your Verified Permissions resources consistently and repeatedly. Describe your resources once, and then provision the same resources over and over in multiple AWS accounts and Regions. Important Amazon Cognito Identity is not available in all of the same AWS Regions as Amazon Verified Permissions. If you receive an error from AWS CloudFormation regarding Amazon Cognito Identity, such as Unrecognized resource types: AWS::Cognito::UserPool, AWS::Cognito::UserPoolClient, we recommend that you create the Amazon Cognito user pool and client in the geographically closest AWS Region where Amazon Cognito Identity is available. Use this newly created user pool when creating the Verified Permissions identity source. Verified Permissions and AWS CloudFormation templates To provision and configure resources for Verified Permissions and related services, you must understand AWS CloudFormation templates. Templates are formatted text files in JSON or YAML. These templates describe the resources that you want to provision in your AWS CloudFormation stacks. If you're unfamiliar with JSON or YAML, you can use AWS CloudFormation Designer to help you get started with AWS CloudFormation templates. For more information, see What is AWS CloudFormation Designer? in the AWS CloudFormation User Guide. Verified Permissions supports creating identity sources, policies, policy stores, and policy templates in AWS CloudFormation. For more information, including examples of JSON and YAML templates for Verified Permissions resources, see the Amazon Verified Permissions resource type reference in the AWS CloudFormation User Guide. Verified Permissions and AWS CloudFormation templates 168 Amazon Verified Permissions AWS CDK constructs User Guide The AWS Cloud Development Kit (AWS CDK) is an open-source software development framework for defining cloud infrastructure in code and provisioning it through AWS CloudFormation. Constructs, or reusable cloud components, can be used to create AWS CloudFormation templates. These templates can then be used to deploy your cloud infrastructure. To learn more and download AWS CDK, see AWS Cloud Development Kit. The following are links to documentation for Verified Permissions AWS CDK resources, such as constructs. • Amazon Verified Permissions L2 CDK Construct Learn more about AWS CloudFormation To learn more about AWS CloudFormation, see the following resources: • AWS CloudFormation • AWS CloudFormation User Guide • AWS CloudFormation API Reference • AWS CloudFormation Command Line Interface User Guide AWS CDK constructs 169 Amazon Verified Permissions User Guide Access Amazon Verified Permissions using AWS PrivateLink You can |
amazon-verified-permissions-user-guide-058 | amazon-verified-permissions-user-guide.pdf | 58 | templates. These templates can then be used to deploy your cloud infrastructure. To learn more and download AWS CDK, see AWS Cloud Development Kit. The following are links to documentation for Verified Permissions AWS CDK resources, such as constructs. • Amazon Verified Permissions L2 CDK Construct Learn more about AWS CloudFormation To learn more about AWS CloudFormation, see the following resources: • AWS CloudFormation • AWS CloudFormation User Guide • AWS CloudFormation API Reference • AWS CloudFormation Command Line Interface User Guide AWS CDK constructs 169 Amazon Verified Permissions User Guide Access Amazon Verified Permissions using AWS PrivateLink You can use AWS PrivateLink to create a private connection between your VPC and Amazon Verified Permissions. You can access Verified Permissions as if it were in your VPC, without the use of an internet gateway, NAT device, VPN connection, or AWS Direct Connect connection. Instances in your VPC don't need public IP addresses to access Verified Permissions. You establish this private connection by creating an interface endpoint, powered by AWS PrivateLink. We create an endpoint network interface in each subnet that you enable for the interface endpoint. These are requester-managed network interfaces that serve as the entry point for traffic destined for Verified Permissions. For more information, see Access AWS services through AWS PrivateLink in the AWS PrivateLink Guide. Considerations for Verified Permissions Before you set up an interface endpoint for Verified Permissions, review Considerations in the AWS PrivateLink Guide. Verified Permissions supports making calls to all of its API actions through the interface endpoint. VPC endpoint policies are not supported for Verified Permissions. By default, full access to Verified Permissions is allowed through the interface endpoint. Alternatively, you can associate a security group with the endpoint network interfaces to control traffic to Verified Permissions through the interface endpoint. Create an interface endpoint for Verified Permissions You can create an interface endpoint for Verified Permissions using either the Amazon VPC console or the AWS Command Line Interface (AWS CLI). For more information, see Create an interface endpoint in the AWS PrivateLink Guide. Create an interface endpoint for Verified Permissions using the following service name: com.amazonaws.region.verifiedpermissions Considerations 170 Amazon Verified Permissions User Guide If you enable private DNS for the interface endpoint, you can make API requests to Verified Permissions using its default Regional DNS name. For example, verifiedpermissions.us- east-1.amazonaws.com. Create an endpoint policy for your interface endpoint An endpoint policy is an IAM resource that you can attach to an interface endpoint. The default endpoint policy allows full access to Verified Permissions through the interface endpoint. To control the access allowed to Verified Permissions from your VPC, attach a custom endpoint policy to the interface endpoint. An endpoint policy specifies the following information: • The principals that can perform actions (AWS accounts, IAM users, and IAM roles). • The actions that can be performed. • The resources on which the actions can be performed. For more information, see Control access to services using endpoint policies in the AWS PrivateLink Guide. Example: VPC endpoint policy for Verified Permissions actions The following is an example of a custom endpoint policy. When you attach this policy to your interface endpoint, it grants access to the listed Verified Permissions actions for all principals on all resources. { "Statement": [ { "Principal": "*", "Effect": "Allow", "Action": [ "verifiedpermissions:IsAuthorized", "verifiedpermissions:IsAuthorizedWithToken", "verifiedpermissions:GetPolicy" ], "Resource":"*" } ] Create an endpoint policy 171 Amazon Verified Permissions } User Guide Create an endpoint policy 172 Amazon Verified Permissions User Guide Quotas for Amazon Verified Permissions Your AWS account has default quotas, formerly referred to as limits, for each AWS service. Unless otherwise noted, each quota is Region-specific. You can request increases for some quotas, and other quotas cannot be increased. To view the quotas for Verified Permissions, open the Service Quotas console. In the navigation pane, choose AWS services and select Verified Permissions. To request a quota increase, see Requesting a Quota Increase in the Service Quotas User Guide. If the quota is not yet available in Service Quotas, use the limit increase form. Your AWS account has the following quotas related to Verified Permissions. Topics • Quotas for resources • Quotas for hierarchies • Quotas for operations per second Quotas for resources Name Default Policy stores per Region per account Policy templates per policy store Each supported Region: 30,000 Each supported Region: 40 Identity sources per policy store 1 Description Adjustabl e Yes Yes No The maximum number of policy stores. The maximum number of policy templates in a policy store. The maximum number of identity sources that you can define for a policy store. Quotas for resources 173 Amazon Verified Permissions User Guide Name Default Authorization request size¹ 1 MB Description Adjustabl e No The maximum size of an authorization request. Policy size 10,000 bytes No Schema size 200,000 |
amazon-verified-permissions-user-guide-059 | amazon-verified-permissions-user-guide.pdf | 59 | for resources Name Default Policy stores per Region per account Policy templates per policy store Each supported Region: 30,000 Each supported Region: 40 Identity sources per policy store 1 Description Adjustabl e Yes Yes No The maximum number of policy stores. The maximum number of policy templates in a policy store. The maximum number of identity sources that you can define for a policy store. Quotas for resources 173 Amazon Verified Permissions User Guide Name Default Authorization request size¹ 1 MB Description Adjustabl e No The maximum size of an authorization request. Policy size 10,000 bytes No Schema size 200,000 bytes No Policy size per resource 200,000 bytes² Yes The maximum size of an individual policy. The maximum size of the schema of a policy store. The maximum size of all policies that reference a specific resource. ¹ The quota for an authorization request is the same for both IsAuthorized and IsAuthorizedWithToken. ² The default limit for the total size of all the policies scoped for a single resource is 200,000 bytes. Similarly, the total size of all the policies, where the scope leaves the resource undefined, thereby applying to all resources, is limited by default to 200,000 bytes. Note that for template-linked policies the size of the policy template is counted only once, plus the size of each set of parameters used to instantiate each template-linked policy. This limit can be raised, provided that your policy design meets certain constraints. If you need to explore this option, contact Support. Template-linked policy size example You can determine how template-linked policies contribute to the Policy size per resource quota by taking the sum of the length of the principal and resource. If the principal or resource isn't specified, the length of that piece is 0. If a resource isn't specified, its size counts towards the "unspecified" resource quota. The size of the template body itself has no impact on the policy size. Let's look at the following template: @id("template1") Template-linked policy size example 174 Amazon Verified Permissions permit ( principal in ?principal, action in [Action::"view", Action::"comment"], resource in ?resource ) unless { resource.tag =="private" }; Let's create the following policies from that template: User Guide TemplateLinkedPolicy { policyId: "policy1", templateId: "template1", principal: User::"alice", resource: Photo::"car.jpg" } TemplateLinkedPolicy { policyId: "policy2", templateId: "template1", principal: User::"bob", resource: Photo::"boat.jpg" } TemplateLinkedPolicy { policyId: "policy3", templateId: "template1", principal: User::"jane", resource: Photo::"car.jpg" TemplateLinkedPolicy { policyId: "policy4", templateId: "template1", principal: User::"jane", resource } Now, let's calculate the size of those policies by counting the characters in the principal and resource for each one. Each character counts as 1 byte. The size of policy1 would be the length of the principal User::"alice" (13) plus the length of the resource Photo::"car.jpg" (16). Adding them up we have 13 + 16 = 29 bytes. Template-linked policy size example 175 Amazon Verified Permissions User Guide The size of policy2 would be the length of the principal User::"bob" (11) plus the length of the resource Photo::"boat.jpg" (17). Adding them up we have 11 + 17 = 28 bytes. The size of policy3 would be the length of the principal User::"jane" (12) plus the length of the resource Photo::"car.jpg" (16). Adding them up we have 12 + 16 = 28 bytes. The size of policy4 would be the length of the principal User::"jane" (12) plus the length of the resource (0). Adding them up we have 12 + 0 = 12 bytes. Since policy2 is the only policy that references the resource Photo::"boat.jpg", the total resource size is 28 bytes. Since policy1 and policy3 both reference the resource Photo::"car.jpg", the total resource size is 29 + 28 = 57 bytes. Since policy4 is the only policy that references the "unspecified" resource, the total resource size is 12 bytes. Quotas for hierarchies Note The following quotas are aggregated, meaning they are added together. The maximum number of transitive parents for the group is what's listed. For example, if the limit of Transitive parents per principal is 100 that means there could be 100 parents of principals and 0 parents for both actions and resources, or any combination of parents that add up to 100 total parents. Name Default Transitive parents per principal 100 Transitive parents per action 100 Description Adjustabl e No No The maximum number of transitive parents for each principal. The maximum number of transitive parents for each action. Quotas for hierarchies 176 Amazon Verified Permissions User Guide Name Default Transitive parents per resource 100 Description Adjustabl e No The maximum number of transitive parents for each resource. The diagram below illustrates how transitive parents can be defined for an entity (principal, action, or resource). Quotas for operations per second Verified Permissions throttles requests to service endpoints in an AWS Region when application requests exceed the quota for an API operation. Verified |
amazon-verified-permissions-user-guide-060 | amazon-verified-permissions-user-guide.pdf | 60 | parents per action 100 Description Adjustabl e No No The maximum number of transitive parents for each principal. The maximum number of transitive parents for each action. Quotas for hierarchies 176 Amazon Verified Permissions User Guide Name Default Transitive parents per resource 100 Description Adjustabl e No The maximum number of transitive parents for each resource. The diagram below illustrates how transitive parents can be defined for an entity (principal, action, or resource). Quotas for operations per second Verified Permissions throttles requests to service endpoints in an AWS Region when application requests exceed the quota for an API operation. Verified Permissions might return an exception when you exceed the quota in requests per second, or you attempt simultaneous write operations. You can view your current RPS quotas in Service Quotas. To prevent applications from exceeding the quota for an operation, you must optimize them for retries and exponential backoff. For more information, see Retry with backoff pattern and Managing and monitoring API throttling in your workloads. Quotas for operations per second 177 Amazon Verified Permissions User Guide Name Default Description Adjustabl e BatchGetPolicy requests per second per Region per account Each supported Region: 10 Yes The maximum number of BatchGetPolicy requests per second. BatchIsAuthorized requests per second per Region per account Each supported Region: 30 Yes The maximum number of BatchIsAuthorized BatchIsAuthorizedWithToken requests per second per Region per account Each supported Region: 30 Yes requests per second. The maximum number of BatchIsAuthorizedW ithToken requests per second. CreatePolicy requests per second per Region per account Each supported Region: 10 Yes The maximum number of CreatePolicy requests per CreatePolicyStore requests per second per Region per account Each supported Region: 1 No second. The maximum number of CreatePolicyStore requests per second. CreatePolicyTemplate requests per second per Region per account Each supported Region: 10 Yes The maximum number of CreatePolicyTemplate DeletePolicy requests per second per Region per account Each supported Region: 10 DeletePolicyStore requests per second per Region per account Each supported Region: 1 Yes No requests per second. The maximum number of DeletePolicy requests per second. The maximum number of DeletePolicyStore requests per second. Quotas for operations per second 178 Amazon Verified Permissions User Guide Name Default Description Adjustabl e DeletePolicyTemplate requests per second per Region per account Each supported Region: 10 Yes The maximum number of DeletePolicyTemplate requests per second. GetPolicy requests per second per Region per account Each supported Region: 10 Yes The maximum number of GetPolicy requests per second. GetPolicyTemplate requests per second per Region per account Each supported Region: 10 Yes The maximum number of GetPolicyTemplate requests per second. GetSchema requests per second per Region per account Each supported Region: 10 Yes The maximum number of GetSchema requests per second. IsAuthorized requests per second per Region per account Each supported Region: 200 Yes The maximum number of IsAuthorized requests per second. IsAuthorizedWithToken requests per second per Region per account Each supported Region: 200 Yes The maximum number of IsAuthorizedWithToken ListPolicies requests per second per Region per account Each supported Region: 10 ListPolicyStores requests per second per Region per account Each supported Region: 10 ListPolicyTemplates requests per second per Region per account Each supported Region: 10 Yes Yes Yes requests per second. The maximum number of ListPolicies requests per second. The maximum number of ListPolicyStores requests per second. The maximum number of ListPolicyTemplates requests per second. Quotas for operations per second 179 Amazon Verified Permissions User Guide Name Default Description Adjustabl e PutSchema requests per second per Region per account Each supported Region: 10 Yes The maximum number of PutSchema requests per second. UpdatePolicy requests per second per Region per account Each supported Region: 10 Yes The maximum number of UpdatePolicy requests UpdatePolicyStore requests per second per Region per account Each supported Region: 10 No per second. The maximum number of UpdatePolicyStore requests per second. UpdatePolicyTemplate requests per second per Region per account Each supported Region: 10 Yes The maximum number of UpdatePolicyTemplate requests per second. Quotas for operations per second 180 Amazon Verified Permissions User Guide Amazon Verified Permissions and Cedar policy language terms and concepts You should understand the following concepts to use Amazon Verified Permissions. Verified Permissions concepts • Authorization model • Authorization request • Authorization response • Considered policies • Context data • Determining policies • Entity data • Permissions, authorization, and principals • Policy enforcement • Policy store • Satisfied policies • Differences between Amazon Verified Permissions and the Cedar policy language Cedar policy language concepts • Authorization • Entity • Groups and hierarchies • Namespaces • Policy • Policy template • Schema 181 Amazon Verified Permissions User Guide Authorization model The authorization model describes the scope of the authorization requests made by the application and the basis for evaluating those requests. It is defined in terms of the different types of resources, the actions |
amazon-verified-permissions-user-guide-061 | amazon-verified-permissions-user-guide.pdf | 61 | • Considered policies • Context data • Determining policies • Entity data • Permissions, authorization, and principals • Policy enforcement • Policy store • Satisfied policies • Differences between Amazon Verified Permissions and the Cedar policy language Cedar policy language concepts • Authorization • Entity • Groups and hierarchies • Namespaces • Policy • Policy template • Schema 181 Amazon Verified Permissions User Guide Authorization model The authorization model describes the scope of the authorization requests made by the application and the basis for evaluating those requests. It is defined in terms of the different types of resources, the actions taken on those resources, and the types principals that take those actions. It also considers the context in which those actions are being taken. Role-based Access Control (RBAC) is an evaluation basis in which roles are defined and associated with a set of permissions. These roles can then be assigned to one or more identities. The assigned identity acquires the permissions associated with the role. If the permissions associated with the role are modified, then the modification automatically impacts any identity to which the role has been assigned. Cedar can support RBAC decisions through the use of principal groups. Attribute-based Access Control (ABAC) is an evaluation basis in which the permissions associated with an identity are determined by attributes of that identity. Cedar can support ABAC decisions through the use of policy conditions that reference attributes of the principal. The Cedar policy language enables the combination of RBAC and ABAC in a single policy by allowing permissions to be defined for a group of users, which have attribute-based conditions. Authorization request An authorization request is a request made of Verified Permissions by an application to evaluate a set of policies in order to determine whether a principal may perform an action on a resource for a given context. Authorization response The authorization response is the response to the authorization request. It includes an allow or deny decision, plus additional information, such as the IDs of the determining policies. Considered policies Considered policies are the full set of policies that are selected by Verified Permissions for inclusion when evaluating an authorization request. Context data Context data are attribute values that provide additional information to be evaluated. Authorization model 182 Amazon Verified Permissions User Guide Determining policies Determining policies are the policies that determine the authorization response. For example, if there are two satisfied policies, where one is a deny and the other is an allow, then the deny policy will be the determining policy. If there are multiple satisfied permit policies and no satisfied forbid policies, then there are multiple determining policies. In the case that no policies match and the response is deny, there are no determining policies. Entity data Entity data are data about the principal, action, and resource. Entity data relevant for policy evaluation are group membership all the way up the entity hierarchy and attribute values of the principal and resource. Permissions, authorization, and principals Verified Permissions manages fine-grained permissions and authorization within custom applications that you build. A principal is user of an application, either human or machine, that has an identity bound to an identifier such as a username or machine ID. The process of authentication determines whether the principal is truly the identity they claim to be. Associated with that identity are a set of application permissions that determine what that principal is permitted to do within that application. Authorization is the process of assessing those permissions to determine whether a principal is permitted to perform a particular action in the application. These permissions can be expressed as policies. Policy enforcement Policy enforcement is the process of enforcing the evaluation decision within the application outside of Verified Permissions. If Verified Permissions evaluation returns a deny, then enforcement would ensure that the principal was prevented from accessing the resource. Policy store A policy store is a container for policies and templates. Each store contains a schema that is used to validate policies added to the store. By default, each application has its own policy store, but Determining policies 183 Amazon Verified Permissions User Guide multiple applications can share a single policy store. When an application makes an authorization request, it identifies the policy store used to evaluate that request. Policy stores provide a way to isolate a set of policies, and can therefore be used in a multi-tenant application to contain the schemas and policies for each tenant. A single application can have separate policy stores for each tenant. When evaluating an authorization request, Verified Permissions only considers the subset of the policies in the policy store that are relevant to the request. Relevance is determined based on the scope of the policy. The scope identifies the specific principal and resource to which the policy |
amazon-verified-permissions-user-guide-062 | amazon-verified-permissions-user-guide.pdf | 62 | makes an authorization request, it identifies the policy store used to evaluate that request. Policy stores provide a way to isolate a set of policies, and can therefore be used in a multi-tenant application to contain the schemas and policies for each tenant. A single application can have separate policy stores for each tenant. When evaluating an authorization request, Verified Permissions only considers the subset of the policies in the policy store that are relevant to the request. Relevance is determined based on the scope of the policy. The scope identifies the specific principal and resource to which the policy applies, and the actions that the principal can perform on the resource. Defining the scope helps improve performance by narrowing the set of considered policies. Satisfied policies Satisfied policies are the policies that match the parameters of the authorization request. Differences between Amazon Verified Permissions and the Cedar policy language Amazon Verified Permissions uses the Cedar policy language engine to perform its authorization tasks. However, there are some differences between the native Cedar implementation and the implementation of Cedar found in Verified Permissions. This topic identifies those differences. Namespace definition Verified Permissions implementation of Cedar has the following differences from the native Cedar implementation: • Verified Permissions supports only one namespace in a schema defined in a policy store. • Verified Permissions doesn't allow you to create a namespace that's an empty string or includes the following values: aws, amazon, or cedar. Policy template support Both Verified Permissions and Cedar allow placeholders in the scope for only the principal and resource. However, Verified Permissions also requires that neither the principal and resource are unconstrained. Satisfied policies 184 Amazon Verified Permissions User Guide The following policy is valid in Cedar but is rejected by Verified Permissions because the principal is unconstrained. permit(principal, action == Action::"view", resource == ?resource); Both of the following examples are valid in both Cedar and Verified Permissions because both the principal and resource have constraints. permit(principal == User::"alice", action == Action::"view", resource == ?resource); permit(principal == ?principal, action == Action::"a", resource in ?resource); Schema support Verified Permissions requires all schema JSON key names to be non-empty strings. Cedar allows empty strings in a few cases, such as for properties or namespaces. Action groups definition The Cedar authorization methods require a list of the entities to be considered when evaluating an authorization request against the policies. You can define the actions and action groups used by your application in the schema. However, Cedar doesn't include the schema as part of an evaluation request. Instead, Cedar uses the schema only to validate the policies and policy templates that you submit. Because Cedar doesn't reference the schema during evaluation requests, even if you defined action groups in the schema, you must also include the list of any action groups as part of the entities list you must pass to the authorization API operations. Verified Permissions does this for you. Any action groups that you define in your schema are automatically appended to the entities list that you pass to as a parameter to the IsAuthorized or IsAuthorizedWithToken operations. Entity formatting The JSON formatting of entities in Verified Permissions using the entityList parameter differs from Cedar in the following ways: Schema support 185 Amazon Verified Permissions User Guide • In Verified Permissions, a JSON object must have all of its key-value pairs wrapped in a JSON object with the name of Record. • A JSON list in Verified Permissions must be wrapped in a JSON key-value pair where the key name is Set and the value is the original JSON list from Cedar. • For String, Long, and Boolean type names, each key-value pair from Cedar is replaced by a JSON object in Verified Permissions. The name of the object is the original key name. Inside the JSON object, there is one key-value pair where the key name is the type name of the scalar value (String, Long, or Boolean) and the value is the value from the Cedar entity. • The syntax formatting of Cedar entities and Verified Permissions entities differs in the following ways: Cedar format Verified Permissions format uid type id attrs parents Identifier EntityType EntityId Attributes Parents Example - Lists The following examples show how a list of entities is expressed in Cedar and Verified Permissions, respectively. Cedar [ { "number": 1 }, { "sentence": "Here is an example sentence" }, { "Question": false Entity formatting 186 Amazon Verified Permissions User Guide } ] Verified Permissions { "Set": [ { "Record": { "number": { "Long": 1 } } }, { "Record": { "sentence": { "String": "Here is an example sentence" } } }, { "Record": { "question": { "Boolean": false } } } ] } Example - Policy evaluation The following examples shows how entities are formatted |
amazon-verified-permissions-user-guide-063 | amazon-verified-permissions-user-guide.pdf | 63 | Example - Lists The following examples show how a list of entities is expressed in Cedar and Verified Permissions, respectively. Cedar [ { "number": 1 }, { "sentence": "Here is an example sentence" }, { "Question": false Entity formatting 186 Amazon Verified Permissions User Guide } ] Verified Permissions { "Set": [ { "Record": { "number": { "Long": 1 } } }, { "Record": { "sentence": { "String": "Here is an example sentence" } } }, { "Record": { "question": { "Boolean": false } } } ] } Example - Policy evaluation The following examples shows how entities are formatted for evaluating a policy in an authorization request in Cedar and Verified Permissions, respectively. Cedar [ { "uid": { "type": "PhotoApp::User", Entity formatting 187 Amazon Verified Permissions User Guide "id": "alice" }, "attrs": { "age": 25, "name": "alice", "userId": "123456789012" }, "parents": [ { "type": "PhotoApp::UserGroup", "id": "alice_friends" }, { "type": "PhotoApp::UserGroup", "id": "AVTeam" } ] }, { "uid": { "type": "PhotoApp::Photo", "id": "vacationPhoto.jpg" }, "attrs": { "private": false, "account": { "__entity": { "type": "PhotoApp::Account", "id": "ahmad" } } }, "parents": [] }, { "uid": { "type": "PhotoApp::UserGroup", "id": "alice_friends" }, "attrs": {}, "parents": [] }, { "uid": { Entity formatting 188 Amazon Verified Permissions User Guide "type": "PhotoApp::UserGroup", "id": "AVTeam" }, "attrs": {}, "parents": [] } ] Verified Permissions [ { "Identifier": { "EntityType": "PhotoApp::User", "EntityId": "alice" }, "Attributes": { "age": { "Long": 25 }, "name": { "String": "alice" }, "userId": { "String": "123456789012" } }, "Parents": [ { "EntityType": "PhotoApp::UserGroup", "EntityId": "alice_friends" }, { "EntityType": "PhotoApp::UserGroup", "EntityId": "AVTeam" } ] }, { "Identifier": { "EntityType": "PhotoApp::Photo", "EntityId": "vacationPhoto.jpg" }, Entity formatting 189 Amazon Verified Permissions User Guide "Attributes": { "private": { "Boolean": false }, "account": { "EntityIdentifier": { "EntityType": "PhotoApp::Account", "EntityId": "ahmad" } } }, "Parents": [] }, { "Identifier": { "EntityType": "PhotoApp::UserGroup", "EntityId": "alice_friends" }, "Parents": [] }, { "Identifier": { "EntityType": "PhotoApp::UserGroup", "EntityId": "AVTeam" }, "Parents": [] } ] Length and size limits Verified Permissions supports storage in the form of policy stores to hold your schema, policies, and policy templates. That storage causes Verified Permissions to impose some length and size limits that aren't relevant to Cedar. Object Verified Permissions limit (in bytes) Cedar limit Policy size¹ 10,000 None Inline policy description 150 Not applicable to Cedar Length and size limits 190 Amazon Verified Permissions Object Verified Permissions limit (in bytes) Cedar limit User Guide Policy template size 10,000 Schema size 100,000 Entity type Policy ID Policy template ID Entity ID Policy store ID 200 64 64 200 64 None None None None None None Not applicable to Cedar ¹ There is a limit for policies per policy store in Verified Permissions based on the combined size of principals, actions, and resources of policies created in the policy store. The total size of all policies pertaining to a single resource can't exceed 200,000 bytes. For template-linked policies, the size of the policy template is counted only once, plus the size of each set of parameters used to instantiate each template-linked policy. Length and size limits 191 Amazon Verified Permissions User Guide Amazon Verified Permissions upgrade to Cedar v4 FAQ Amazon Verified Permissions is in the process of updating to Cedar v4. We're working to make this as seamless as possible for you. The following FAQs should answer your questions and help you prepare. Topics • What is the current state on the upgrade? • Do I need to do anything right now? • Does the upgrade of the console impact the authorization service? • What are the breaking changes in Cedar v3 and Cedar v4? • When will the upgrade to Cedar v4 be complete? What is the current state on the upgrade? As a first step we've upgraded the console to use Cedar v4.3, however the back end is still running on Cedar v2.5.0. This means that while you can now use the console to author policies using new features like the is operator, when you attempt to save them you will still get an error until we complete the upgrade. Do I need to do anything right now? No. You can start exploring Cedar v4 using the console, if you want, but don't need to do anything. Does the upgrade of the console impact the authorization service? No. Prior to upgrading we will run tests to check that your policy store works correctly with Cedar v4. There are some minor breaking changes between v2.5.0 and v4.3, but it’s very unlikely that your policy store will be impacted. If it is, then your policy store will not be upgraded, and will continue to authorize using Cedar v2.5.0. Should this happen, we will reach out to explain any changes you need to make before being able to upgrade. What is the current state on the |
amazon-verified-permissions-user-guide-064 | amazon-verified-permissions-user-guide.pdf | 64 | need to do anything. Does the upgrade of the console impact the authorization service? No. Prior to upgrading we will run tests to check that your policy store works correctly with Cedar v4. There are some minor breaking changes between v2.5.0 and v4.3, but it’s very unlikely that your policy store will be impacted. If it is, then your policy store will not be upgraded, and will continue to authorize using Cedar v2.5.0. Should this happen, we will reach out to explain any changes you need to make before being able to upgrade. What is the current state on the upgrade? 192 Amazon Verified Permissions User Guide What are the breaking changes in Cedar v3 and Cedar v4? Breaking changes are identified in the Cedar change log, marked with an (*). Note If your policy store is affected by breaking changes it won't be upgraded, and we'll work with you to update the policy store so it can be upgraded. When will the upgrade to Cedar v4 be complete? Our goal is for all accounts to be upgraded by December 31, 2025. What are the breaking changes in Cedar v3 and Cedar v4? 193 Amazon Verified Permissions User Guide Document history for the Amazon Verified Permissions User Guide The following table describes the documentation releases for Verified Permissions. Change Description Date New AWS managed policies You can now use the October 11, 2024 AmazonVerifiedPerm issionsFullAccess and AmazonVerifiedPerm issionsReadOnlyAcc ess IAM managed policies with Verified Permissions. You can now authorize users from OpenID Connect (OIDC) identity providers. You can now authorize users from a Amazon Cognito user pool in a single BatchIsAu API thorizedWithToken request. June 8, 2024 April 5, 2024 OIDC identity sources Batch authorization with identity source tokens Creating a policy store with API Gateway You can now create a policy store from an existing API and Amazon Cognito user pool. April 1, 2024 Context concepts and example Added information about context in authorization requests with Verified Permissions. February 1, 2024 Authorization concepts and example Added information about authorization requests with February 1, 2024 Verified Permissions. 194 Amazon Verified Permissions User Guide AWS CloudFormation integration Verified Permissions supports creating identity sources, June 30, 2023 policies, policy stores, and policy templates in AWS CloudFormation. Initial release Initial release of the Amazon Verified Permissions User June 13, 2023 Guide 195 |
AmazonCloudFront_DevGuide-001 | AmazonCloudFront_DevGuide.pdf | 1 | Developer Guide Amazon CloudFront Copyright © 2025 Amazon Web Services, Inc. and/or its affiliates. All rights reserved. Amazon CloudFront Developer Guide Amazon CloudFront: Developer Guide Copyright © 2025 Amazon Web Services, Inc. and/or its affiliates. All rights reserved. Amazon's trademarks and trade dress may not be used in connection with any product or service that is not Amazon's, in any manner that is likely to cause confusion among customers, or in any manner that disparages or discredits Amazon. All other trademarks not owned by Amazon are the property of their respective owners, who may or may not be affiliated with, connected to, or sponsored by Amazon. Amazon CloudFront Table of Contents Developer Guide What is Amazon CloudFront? ......................................................................................................... 1 How you set up CloudFront to deliver content ..................................................................................... 2 Pricing ............................................................................................................................................................. 4 Ways to use CloudFront .............................................................................................................................. 4 Accelerate static website content delivery ........................................................................................ 4 Serve video on demand or live streaming video .............................................................................. 5 Encrypt specific fields throughout system processing .................................................................... 5 Customize at the edge ........................................................................................................................... 5 Serve private content by using Lambda@Edge customizations .................................................... 6 How CloudFront delivers content ............................................................................................................. 6 How CloudFront delivers content to your users ............................................................................... 7 How CloudFront works with regional edge caches .......................................................................... 8 CloudFront edge servers ........................................................................................................................... 10 Use the CloudFront managed prefix list .......................................................................................... 11 Working with AWS SDKs .......................................................................................................................... 11 CloudFront technical resources ............................................................................................................... 12 Get started ..................................................................................................................................... 14 Set up your AWS account ......................................................................................................................... 14 Sign up for an AWS account .............................................................................................................. 14 Create a user with administrative access ......................................................................................... 15 Choose how to access CloudFront .................................................................................................... 16 Get started with a basic distribution ..................................................................................................... 17 Prerequisites ........................................................................................................................................... 18 Create bucket ......................................................................................................................................... 18 Upload content ...................................................................................................................................... 18 Create distribution ................................................................................................................................ 19 Access the content ................................................................................................................................ 20 Clean up .................................................................................................................................................. 20 Enhance your basic distribution ........................................................................................................ 21 Get started with a secure static website ............................................................................................... 21 Solution overview ................................................................................................................................. 22 Deploy the solution .............................................................................................................................. 23 Configure distributions ................................................................................................................. 29 Understand how multi-tenant distributions work ............................................................................... 31 iii Amazon CloudFront Developer Guide How it works .......................................................................................................................................... 32 Terms ....................................................................................................................................................... 34 Unsupported features .......................................................................................................................... 35 CloudFront multi-tenant distribution reference ............................................................................. 36 Distribution tenant customizations ................................................................................................... 48 Request certificates (distribution tenant) ........................................................................................ 50 Create custom connection group (optional) ................................................................................... 55 Create a distribution .................................................................................................................................. 57 Create a CloudFront distribution in the console ............................................................................ 59 Values that are displayed .................................................................................................................... 63 Additional links ...................................................................................................................................... 64 Distribution settings .................................................................................................................................. 65 Origin settings ....................................................................................................................................... 65 Cache behavior settings ...................................................................................................................... 75 Distribution settings ............................................................................................................................. 89 Custom error pages and error caching ............................................................................................ 98 Geographic restrictions ..................................................................................................................... 100 Test a distribution .................................................................................................................................... 100 Create links to your objects ............................................................................................................. 100 Update a distribution .............................................................................................................................. 101 Update a distribution in the console ............................................................................................. 101 Tag a distribution ..................................................................................................................................... 104 Tag restrictions .................................................................................................................................... 105 Add, edit, and delete tags for distributions .................................................................................. 105 Programmatic tagging ....................................................................................................................... 106 Delete a distribution ............................................................................................................................... 107 Use various origins .................................................................................................................................. 109 Use an Amazon S3 bucket ............................................................................................................... 110 Use a MediaStore container or a MediaPackage channel ........................................................... 121 Use an Application Load Balancer .................................................................................................. 121 Use a Lambda function URL ............................................................................................................ 122 Use Amazon EC2 (or another custom origin) ............................................................................... 123 Use CloudFront origin groups .......................................................................................................... 125 Use Amazon API Gateway ................................................................................................................ 125 Use continuous deployment to safely test changes ......................................................................... 125 CloudFront continuous deployment workflow ............................................................................. 127 iv Amazon CloudFront Developer Guide Work with a staging distribution and continuous deployment policy ..................................... 128 Monitor a staging distribution ......................................................................................................... 138 Learn how continuous deployment works .................................................................................... 139 Quotas and other considerations for continuous deployment ................................................. 141 Use custom URLs ..................................................................................................................................... 142 Requirements for using alternate domain names ....................................................................... 142 Restrictions on using alternate domain names ............................................................................ 144 Add an alternate domain name ...................................................................................................... 146 Move an alternate domain name to a different distribution ..................................................... 150 Remove an alternate domain name ............................................................................................... 156 Use wildcards in alternate domain names .................................................................................... 157 Use WebSockets ....................................................................................................................................... 158 How the WebSocket protocol works .............................................................................................. 158 WebSocket requirements .................................................................................................................. 158 Recommended WebSocket headers ................................................................................................ 159 Request Anycast static IPs to use for allowlisting ............................................................................ 159 Prerequisites ........................................................................................................................................ 160 Request an Anycast static IP list ..................................................................................................... 160 Create an Anycast static IP list ........................................................................................................ 161 Associate an Anycast static IP list with an existing distribution ............................................... 161 Associate an Anycast static IP list with a new distribution ........................................................ 162 Using gRPC ................................................................................................................................................ 162 How gRPC works in CloudFront ...................................................................................................... 163 Caching and availability .............................................................................................................. 165 Improve your cache hit ratio ................................................................................................................. 166 Specify how long CloudFront caches your objects ...................................................................... 166 Use Origin Shield ................................................................................................................................ 166 Caching based on query string parameters .................................................................................. 167 Caching based on cookie values ..................................................................................................... 167 Caching based on request headers ................................................................................................. 168 Remove Accept-Encoding header when compression is not needed .................................. 169 Serve media content over HTTP ..................................................................................................... 170 Using Origin Shield ................................................................................................................................. 170 Use cases for Origin Shield .............................................................................................................. 171 Choosing the |
AmazonCloudFront_DevGuide-002 | AmazonCloudFront_DevGuide.pdf | 2 | Anycast static IP list with a new distribution ........................................................ 162 Using gRPC ................................................................................................................................................ 162 How gRPC works in CloudFront ...................................................................................................... 163 Caching and availability .............................................................................................................. 165 Improve your cache hit ratio ................................................................................................................. 166 Specify how long CloudFront caches your objects ...................................................................... 166 Use Origin Shield ................................................................................................................................ 166 Caching based on query string parameters .................................................................................. 167 Caching based on cookie values ..................................................................................................... 167 Caching based on request headers ................................................................................................. 168 Remove Accept-Encoding header when compression is not needed .................................. 169 Serve media content over HTTP ..................................................................................................... 170 Using Origin Shield ................................................................................................................................. 170 Use cases for Origin Shield .............................................................................................................. 171 Choosing the AWS Region for Origin Shield ................................................................................ 176 Enabling Origin Shield ...................................................................................................................... 178 v Amazon CloudFront Developer Guide Estimating Origin Shield costs ......................................................................................................... 180 Origin Shield high availability ......................................................................................................... 181 How Origin Shield interacts with other CloudFront features .................................................... 181 Increase availability with origin failover ............................................................................................. 182 Create an origin group ...................................................................................................................... 184 Control origin timeouts and attempts ........................................................................................... 185 Use origin failover with Lambda@Edge functions ...................................................................... 187 Use custom error pages with origin failover ................................................................................ 188 Manage cache expiration ....................................................................................................................... 189 Use headers to control cache duration for individual objects ................................................... 190 Serve stale (expired) content ........................................................................................................... 191 Specify the amount of time that CloudFront caches objects .................................................... 194 Add headers to your objects by using the Amazon S3 console ................................................ 198 Caching and query string parameters ................................................................................................. 199 Console and API settings for query string forwarding and caching ......................................... 201 Optimize caching ................................................................................................................................ 201 Query string parameters and CloudFront standard logs (access logs) .................................... 203 Cache content based on cookies .......................................................................................................... 203 Cache content based on request headers .......................................................................................... 206 Headers and distributions – overview ............................................................................................ 207 Select the headers to base caching on .......................................................................................... 208 Configure CloudFront to respect CORS settings .......................................................................... 209 Configure caching based on the device type ............................................................................... 210 Configure caching based on the language of the viewer ........................................................... 210 Configure caching based on the location of the viewer ............................................................. 211 Configure caching based on the protocol of the request .......................................................... 211 Configure caching for compressed files ......................................................................................... 211 How caching based on headers affects performance ................................................................. 211 How the case of headers and header values affects caching .................................................... 211 Headers that CloudFront returns to the viewer ........................................................................... 212 Control the cache key with a policy ........................................................................................... 213 Understand cache policies ..................................................................................................................... 214 Policy information .............................................................................................................................. 214 Time to live (TTL) settings ............................................................................................................... 214 Cache key settings .............................................................................................................................. 215 Create cache policies ............................................................................................................................... 221 vi Amazon CloudFront Developer Guide Use managed cache policies .................................................................................................................. 224 Amplify ................................................................................................................................................. 225 CachingDisabled .................................................................................................................................. 226 CachingOptimized .............................................................................................................................. 227 CachingOptimizedForUncompressedObjects ................................................................................ 228 Elemental-MediaPackage .................................................................................................................. 228 UseOriginCacheControlHeaders ....................................................................................................... 229 UseOriginCacheControlHeaders-QueryStrings ............................................................................. 230 Understand the cache key ..................................................................................................................... 231 Default cache key ............................................................................................................................... 231 Customize the cache key .................................................................................................................. 233 Control origin requests with a policy ........................................................................................ 235 Understand origin request policies ...................................................................................................... 236 Policy information .............................................................................................................................. 236 Origin request settings ...................................................................................................................... 236 Create origin request policies ................................................................................................................ 238 Use managed origin request policies .................................................................................................. 242 AllViewer ............................................................................................................................................... 243 AllViewerAndCloudFrontHeaders-2022-06 ................................................................................... 243 AllViewerExceptHostHeader ............................................................................................................. 245 CORS-CustomOrigin ........................................................................................................................... 245 CORS-S3Origin .................................................................................................................................... 246 Elemental-MediaTailor-PersonalizedManifests ............................................................................. 246 UserAgentRefererHeaders ................................................................................................................. 247 Add CloudFront request headers .......................................................................................................... 248 Device type headers ........................................................................................................................... 248 Viewer location headers .................................................................................................................... 249 Headers to determine the viewer's header structure .................................................................. 250 TLS-related headers ........................................................................................................................... 251 Other CloudFront headers ................................................................................................................ 252 Understand how origin request policies and cache policies work together ................................. 252 Add or remove response headers with a policy ........................................................................ 256 Understand response headers policies ................................................................................................ 257 Policy details (metadata) .................................................................................................................. 257 CORS headers ...................................................................................................................................... 258 Security headers ................................................................................................................................. 261 vii Amazon CloudFront Developer Guide Custom headers .................................................................................................................................. 264 Remove headers .................................................................................................................................. 264 Server-Timing header ........................................................................................................................ 266 Create response headers policies ......................................................................................................... 271 Use managed response headers policies ............................................................................................ 277 CORS-and-SecurityHeadersPolicy ................................................................................................... 278 CORS-With-Preflight .......................................................................................................................... 279 CORS-with-preflight-and-SecurityHeadersPolicy ......................................................................... 280 SecurityHeadersPolicy ........................................................................................................................ 281 SimpleCORS ......................................................................................................................................... 281 Request and response behavior .................................................................................................. 283 How CloudFront processes HTTP and HTTPS requests ................................................................... 283 Request and response behavior for Amazon S3 origins .................................................................. 284 How CloudFront processes and forwards requests to your Amazon S3 origin ....................... 284 How CloudFront processes responses from your Amazon S3 origin ........................................ 291 Request and response behavior for custom origins ......................................................................... 293 How CloudFront processes and forwards requests to your custom origin .............................. 293 How CloudFront processes responses from your custom origin ............................................... 311 Request and response behavior for origin groups ............................................................................ 315 Add custom headers to origin requests .............................................................................................. 316 Use cases .............................................................................................................................................. 316 Configure CloudFront to add custom headers to origin requests ............................................ 317 Custom headers that CloudFront can’t add to origin requests ................................................. 318 Configure CloudFront to forward the Authorization header ............................................. 319 How CloudFront processes range GETs ............................................................................................... 319 Use range requests to cache large objects ................................................................................... 321 How CloudFront processes HTTP 3xx status codes from your origin ............................................ 321 How CloudFront processes HTTP 4xx |
AmazonCloudFront_DevGuide-003 | AmazonCloudFront_DevGuide.pdf | 3 | your custom origin .............................. 293 How CloudFront processes responses from your custom origin ............................................... 311 Request and response behavior for origin groups ............................................................................ 315 Add custom headers to origin requests .............................................................................................. 316 Use cases .............................................................................................................................................. 316 Configure CloudFront to add custom headers to origin requests ............................................ 317 Custom headers that CloudFront can’t add to origin requests ................................................. 318 Configure CloudFront to forward the Authorization header ............................................. 319 How CloudFront processes range GETs ............................................................................................... 319 Use range requests to cache large objects ................................................................................... 321 How CloudFront processes HTTP 3xx status codes from your origin ............................................ 321 How CloudFront processes HTTP 4xx and 5xx status codes from your origin ............................. 322 How CloudFront processes errors when you have configured custom error pages ............... 323 How CloudFront processes errors if you haven't configured custom error pages .................. 325 HTTP 4xx and 5xx status codes that CloudFront caches ............................................................ 327 Generate custom error responses ........................................................................................................ 329 Configure error response behavior ................................................................................................. 329 Create a custom error page for specific HTTP status codes ...................................................... 331 Store objects and custom error pages in different locations .................................................... 333 Change response codes returned by CloudFront ......................................................................... 333 viii Amazon CloudFront Developer Guide Control how long CloudFront caches errors ................................................................................. 334 Add, remove, or replace content ................................................................................................ 336 Add and access content .......................................................................................................................... 336 Use file versioning to update or remove existing content .............................................................. 337 Update existing files using versioned file names ........................................................................ 337 Remove content so CloudFront won’t distribute it ..................................................................... 337 Customize file URLs ................................................................................................................................. 338 Use your own domain name (example.com) ................................................................................ 339 Use a trailing slash (/) in URLs ........................................................................................................ 339 Create signed URLs for restricted content .................................................................................... 339 Specify a default root object ................................................................................................................ 340 How to specify a default root object ............................................................................................. 340 How default root object works ....................................................................................................... 342 How CloudFront works if you don’t define a root object .......................................................... 343 Invalidate files to remove content ....................................................................................................... 344 Choose between invalidating files and using versioned file names ......................................... 344 Determine which files to invalidate ................................................................................................ 345 What you need to know when invalidating files ......................................................................... 345 Invalidate files ..................................................................................................................................... 349 Concurrent invalidation request maximum ................................................................................... 353 Pay for file invalidation ..................................................................................................................... 353 Serve compressed files ........................................................................................................................... 354 Configure CloudFront to compress objects ................................................................................... 354 How CloudFront compression works .............................................................................................. 355 When CloudFront compresses objects ........................................................................................... 356 File types that CloudFront compresses .......................................................................................... 358 ETag header conversion ................................................................................................................... 360 Use AWS WAF protections .......................................................................................................... 361 Enable AWS WAF for distributions ....................................................................................................... 362 Enable AWS WAF for a new distribution ....................................................................................... 362 Use an existing web ACL ................................................................................................................... 363 Enable bot control ............................................................................................................................. 364 Configure protection by bot category ........................................................................................... 364 Manage AWS WAF security protections for CloudFront .................................................................. 365 Prerequisites ........................................................................................................................................ 366 Enable AWS WAF logs ....................................................................................................................... 366 ix Amazon CloudFront Developer Guide Set up rate limiting ................................................................................................................................. 367 Disable AWS WAF security protections ............................................................................................... 368 Configure secure access and restrict access to content ............................................................. 370 Use HTTPS with CloudFront .................................................................................................................. 370 Require HTTPS between viewers and CloudFront ....................................................................... 372 Require HTTPS to a custom origin ................................................................................................. 374 Require HTTPS to an Amazon S3 origin ........................................................................................ 377 Supported protocols and ciphers between viewers and CloudFront ....................................... 379 Supported protocols and ciphers between CloudFront and the origin ................................... 386 Use alternate domain names and HTTPS ........................................................................................... 389 Choose how CloudFront serves HTTPS requests ......................................................................... 389 Requirements for using SSL/TLS certificates with CloudFront ................................................. 393 Quotas on using SSL/TLS certificates with CloudFront (HTTPS between viewers and CloudFront only) ................................................................................................................................. 397 Configure alternate domain names and HTTPS .......................................................................... 399 Determine the size of the public key in an SSL/TLS RSA certificate ....................................... 403 Increase the quotas for SSL/TLS certificates ................................................................................ 404 Rotate SSL/TLS certificates .............................................................................................................. 405 Revert from a custom SSL/TLS certificate to the default CloudFront certificate .................. 406 Switch from a custom SSL/TLS certificate with dedicated IP addresses to SNI ..................... 408 Restrict content with signed URLs and signed cookies .................................................................... 408 How to serve private content .......................................................................................................... 409 Restrict access to files ....................................................................................................................... 410 Specify trusted signers ...................................................................................................................... 412 Decide to use signed URLs or signed cookies .............................................................................. 421 Use signed URLs ................................................................................................................................. 422 Use signed cookies ............................................................................................................................. 443 Linux commands and OpenSSL for base64 encoding and encryption .................................... 470 Code examples for signed URLs ...................................................................................................... 471 Restrict access to an AWS origin .......................................................................................................... 499 Restrict access to an AWS Elemental MediaPackage v2 origin ................................................. 500 Restrict access to an AWS Elemental MediaStore origin ............................................................ 507 Restrict access to an AWS Lambda function URL origin ............................................................ 514 Restrict access to an Amazon S3 origin ......................................................................................... 524 Restrict access with VPC origins ...................................................................................................... 539 Restrict access to Application Load Balancers ................................................................................... 545 x Amazon CloudFront Developer Guide Configure CloudFront to add a custom HTTP header to requests ........................................... 546 Configure an Application Load Balancer to only forward requests that contain a specific header ................................................................................................................................................... 548 |
AmazonCloudFront_DevGuide-004 | AmazonCloudFront_DevGuide.pdf | 4 | URLs ...................................................................................................... 471 Restrict access to an AWS origin .......................................................................................................... 499 Restrict access to an AWS Elemental MediaPackage v2 origin ................................................. 500 Restrict access to an AWS Elemental MediaStore origin ............................................................ 507 Restrict access to an AWS Lambda function URL origin ............................................................ 514 Restrict access to an Amazon S3 origin ......................................................................................... 524 Restrict access with VPC origins ...................................................................................................... 539 Restrict access to Application Load Balancers ................................................................................... 545 x Amazon CloudFront Developer Guide Configure CloudFront to add a custom HTTP header to requests ........................................... 546 Configure an Application Load Balancer to only forward requests that contain a specific header ................................................................................................................................................... 548 (Optional) Improve the security of this solution .......................................................................... 550 (Optional) Limit access to origin by using the AWS-managed prefix list for CloudFront ...... 551 Geographic restriction ............................................................................................................................. 551 Use CloudFront geographic restrictions ........................................................................................ 552 Use a third-party geolocation service ............................................................................................ 554 Use field-level encryption to help protect sensitive data ............................................................... 555 Overview of field-level encryption ................................................................................................. 557 Set up field-level encryption ........................................................................................................... 558 Decrypt data fields at your origin .................................................................................................. 563 Video on demand and live streaming video .............................................................................. 567 About streaming video ........................................................................................................................... 567 Deliver video on demand ....................................................................................................................... 568 Configure video on demand for Microsoft Smooth Streaming ................................................. 569 Deliver video streaming .......................................................................................................................... 571 Serve video by using AWS Elemental MediaStore as the origin ............................................... 572 Serve live video formatted with AWS Elemental MediaPackage .............................................. 573 Serve video-on-demand content with AWS Elemental MediaPackage .................................... 578 Media quality-aware resiliency .............................................................................................................. 584 MQAR log fields .................................................................................................................................. 586 Use functions to customize at the edge .................................................................................... 587 Differences between CloudFront Functions and Lambda@Edge ................................................... 588 Customize with CloudFront Functions ................................................................................................ 590 Tutorial: Create a simple CloudFront function ............................................................................. 591 Tutorial: Create a CloudFront function that uses key values ..................................................... 594 Write function code ........................................................................................................................... 597 Create functions .................................................................................................................................. 677 Test functions ...................................................................................................................................... 680 Update functions ................................................................................................................................ 685 Publish functions ................................................................................................................................ 688 Associate functions with distributions ........................................................................................... 689 CloudFront KeyValueStore .............................................................................................................. 693 Customize with Lambda@Edge ............................................................................................................ 714 How Lambda@Edge works with requests and responses .......................................................... 715 xi Amazon CloudFront Developer Guide Ways to use Lambda@Edge ............................................................................................................. 715 Get started with Lambda@Edge ..................................................................................................... 716 Set up IAM permissions and roles .................................................................................................. 724 Write and create a Lambda@Edge function ................................................................................. 731 Add triggers for a Lambda@Edge function .................................................................................. 736 Test and debug ................................................................................................................................... 743 Delete functions and replicas .......................................................................................................... 750 Event structure .................................................................................................................................... 751 Work with requests and responses ................................................................................................. 767 Example functions .............................................................................................................................. 773 Restrictions on edge functions ............................................................................................................. 812 Restrictions on all edge functions .................................................................................................. 812 Restrictions on CloudFront Functions ............................................................................................ 818 Restrictions on Lambda@Edge ........................................................................................................ 821 Reports, metrics, and logs .......................................................................................................... 826 AWS billing and usage reports for CloudFront .................................................................................. 826 View the AWS billing report for CloudFront ................................................................................. 827 View the AWS usage report for CloudFront ................................................................................. 828 Interpret your AWS bill and usage reports for CloudFront ........................................................ 830 View CloudFront console reports ......................................................................................................... 836 View CloudFront cache statistics reports ...................................................................................... 837 View CloudFront popular objects reports ..................................................................................... 843 View CloudFront top referrers reports ........................................................................................... 849 View CloudFront usage reports ....................................................................................................... 853 View CloudFront viewers reports .................................................................................................... 860 Monitor CloudFront metrics with Amazon CloudWatch .................................................................. 872 View CloudFront and edge function metrics ................................................................................ 873 Create alarms ...................................................................................................................................... 880 Download metrics data ..................................................................................................................... 881 Get metrics by using the CloudWatch API .................................................................................... 884 CloudFront and edge function logging ............................................................................................... 890 Logging requests ................................................................................................................................ 890 Logging edge functions .................................................................................................................... 891 Logging service activity ..................................................................................................................... 891 Standard logging (access logs) ........................................................................................................ 892 Use real-time logs .............................................................................................................................. 937 xii Amazon CloudFront Developer Guide Edge function logs ............................................................................................................................. 958 AWS CloudTrail logs ........................................................................................................................... 961 Track configuration changes with AWS Config .................................................................................. 974 Set up AWS Config with CloudFront .............................................................................................. 975 View CloudFront configuration history .......................................................................................... 976 Evaluate CloudFront configurations with AWS Config Rules ..................................................... 977 Security ........................................................................................................................................ 978 Data protection ........................................................................................................................................ 978 Encryption in transit .......................................................................................................................... 980 Encryption at rest ............................................................................................................................... 981 Restrict access to content ................................................................................................................. 981 Identity and Access Management ........................................................................................................ 982 Audience ............................................................................................................................................... 982 Authenticating with identities ......................................................................................................... 983 Managing access using policies ....................................................................................................... 986 How Amazon CloudFront works with IAM .................................................................................... 989 Identity-based policy examples ....................................................................................................... 995 AWS managed policies .................................................................................................................... 1005 Use service-linked roles .................................................................................................................. 1011 Troubleshoot CloudFront identity and access ............................................................................ 1016 Logging and monitoring ...................................................................................................................... 1018 Compliance validation .......................................................................................................................... 1019 CloudFront compliance best practices ......................................................................................... 1020 Resilience ................................................................................................................................................. 1021 CloudFront origin failover .............................................................................................................. 1021 Infrastructure security .......................................................................................................................... 1022 Troubleshooting ......................................................................................................................... 1023 Troubleshooting distribution issues ................................................................................................... 1023 CloudFront returns an Access Denied error ................................................................................ 1023 CloudFront returns an InvalidViewerCertificate error when I try to add an alternate domain name ................................................................................................................................................... 1026 CloudFront returns an incorrectly configured DNS record error when I try to add a new CNAME ................................................................................................................................................ 1027 I can't view the files in my distribution ....................................................................................... 1028 Error message: Certificate: <certificate-id> is being used by CloudFront ............................. 1029 Troubleshooting error response status codes .................................................................................. 1030 xiii Amazon |
AmazonCloudFront_DevGuide-005 | AmazonCloudFront_DevGuide.pdf | 5 | .......................................................................................................................... 1019 CloudFront compliance best practices ......................................................................................... 1020 Resilience ................................................................................................................................................. 1021 CloudFront origin failover .............................................................................................................. 1021 Infrastructure security .......................................................................................................................... 1022 Troubleshooting ......................................................................................................................... 1023 Troubleshooting distribution issues ................................................................................................... 1023 CloudFront returns an Access Denied error ................................................................................ 1023 CloudFront returns an InvalidViewerCertificate error when I try to add an alternate domain name ................................................................................................................................................... 1026 CloudFront returns an incorrectly configured DNS record error when I try to add a new CNAME ................................................................................................................................................ 1027 I can't view the files in my distribution ....................................................................................... 1028 Error message: Certificate: <certificate-id> is being used by CloudFront ............................. 1029 Troubleshooting error response status codes .................................................................................. 1030 xiii Amazon CloudFront Developer Guide HTTP 400 status code (Bad Request) .......................................................................................... 1031 HTTP 401 status code (Unauthorized) ........................................................................................ 1032 HTTP 403 status code (Permission Denied) ............................................................................... 1033 HTTP 404 status code (Not Found) .............................................................................................. 1035 HTTP 405 status code (Method Not Allowed) ........................................................................... 1036 HTTP 412 status code (Precondition Failed) .............................................................................. 1036 HTTP 500 status code (Internal Server Error) ............................................................................ 1037 HTTP 502 status code (Bad Gateway) ......................................................................................... 1037 HTTP 503 status code (Service Unavailable) .............................................................................. 1042 HTTP 504 status code (Gateway Timeout) ................................................................................. 1044 Load testing CloudFront ...................................................................................................................... 1049 Quotas ........................................................................................................................................ 1051 General quotas ....................................................................................................................................... 1052 General quotas on distributions ......................................................................................................... 1052 General quotas on policies .................................................................................................................. 1055 Quotas on CloudFront Functions ....................................................................................................... 1057 Quotas on key value stores ................................................................................................................. 1057 Quotas on Lambda@Edge ................................................................................................................... 1058 Quotas on SSL certificates .................................................................................................................. 1060 Quotas on invalidations ....................................................................................................................... 1060 Quotas on key groups .......................................................................................................................... 1061 Quotas on WebSocket connections ................................................................................................... 1062 Quotas on field-level encryption ....................................................................................................... 1062 Quotas on cookies (legacy cache settings) ...................................................................................... 1063 Quotas on query strings (legacy cache settings) ............................................................................ 1063 Quotas on headers ................................................................................................................................ 1064 Quotas on multi-tenant distributions ............................................................................................... 1065 Related information .............................................................................................................................. 1066 Code examples ........................................................................................................................... 1067 Basics ........................................................................................................................................................ 1068 Actions ................................................................................................................................................ 1069 Scenarios .................................................................................................................................................. 1122 Delete signing resources ................................................................................................................. 1123 Sign URLs and cookies .................................................................................................................... 1125 CloudFront Functions examples ......................................................................................................... 1128 Add HTTP security headers ............................................................................................................ 1129 xiv Amazon CloudFront Developer Guide Add a CORS header ......................................................................................................................... 1130 Add a cache control header ........................................................................................................... 1131 Add a true client IP header ............................................................................................................ 1132 Add an origin header ...................................................................................................................... 1133 Add index.html to request URLs ................................................................................................... 1134 Normalize query string parameters ............................................................................................. 1135 Redirect to a new URL .................................................................................................................... 1136 Rewrite a request URI ..................................................................................................................... 1137 Select origin closer to the viewer ................................................................................................. 1139 Use key-value pairs .......................................................................................................................... 1141 Validate a simple token .................................................................................................................. 1142 Document history ...................................................................................................................... 1147 xv Amazon CloudFront Developer Guide What is Amazon CloudFront? Amazon CloudFront is a web service that speeds up distribution of your static and dynamic web content, such as .html, .css, .js, and image files, to your users. CloudFront delivers your content through a worldwide network of data centers called edge locations. When a user requests content that you're serving with CloudFront, the request is routed to the edge location that provides the lowest latency (time delay), so that content is delivered with the best possible performance. • If the content is already in the edge location with the lowest latency, CloudFront delivers it immediately. • If the content is not in that edge location, CloudFront retrieves it from an origin that you've defined—such as an Amazon S3 bucket, a MediaPackage channel, or an HTTP server (for example, a web server) that you have identified as the source for the definitive version of your content. As an example, suppose that you're serving an image from a traditional web server, not from CloudFront. For example, you might serve an image, sunsetphoto.png, using the URL https:// example.com/sunsetphoto.png. Your users can easily navigate to this URL and see the image. But they probably don't know that their request is routed from one network to another—through the complex collection of interconnected networks that comprise the internet—until the image is found. CloudFront speeds up the distribution of your content by routing each user request through the AWS backbone network to the edge location that can best serve your content. Typically, this is a CloudFront edge server that provides the fastest delivery to the viewer. Using the AWS network dramatically reduces the number of networks that your users' requests must pass through, which improves performance. Users get lower latency—the time it takes to load the first byte of the file— and higher data transfer rates. You also get increased reliability and availability because copies of your files (also known as objects) are now held (or cached) in multiple edge locations around the world. Topics • How you set up CloudFront to deliver content • Pricing 1 Amazon CloudFront • Ways to use CloudFront • How CloudFront delivers content • Locations and IP address ranges of CloudFront edge servers • Using CloudFront with an AWS SDK • CloudFront technical resources Developer Guide How you set up CloudFront to deliver content You create a CloudFront distribution |
AmazonCloudFront_DevGuide-006 | AmazonCloudFront_DevGuide.pdf | 6 | the first byte of the file— and higher data transfer rates. You also get increased reliability and availability because copies of your files (also known as objects) are now held (or cached) in multiple edge locations around the world. Topics • How you set up CloudFront to deliver content • Pricing 1 Amazon CloudFront • Ways to use CloudFront • How CloudFront delivers content • Locations and IP address ranges of CloudFront edge servers • Using CloudFront with an AWS SDK • CloudFront technical resources Developer Guide How you set up CloudFront to deliver content You create a CloudFront distribution to tell CloudFront where you want content to be delivered from, and the details about how to track and manage content delivery. Then CloudFront uses computers—edge servers—that are close to your viewers to deliver that content quickly when someone wants to see it or use it. How you set up CloudFront to deliver content 2 Amazon CloudFront Developer Guide How you configure CloudFront to deliver your content 1. You specify origin servers, like an Amazon S3 bucket or your own HTTP server, from which CloudFront gets your files which will then be distributed from CloudFront edge locations all over the world. An origin server stores the original, definitive version of your objects. If you're serving content over HTTP, your origin server is either an Amazon S3 bucket or an HTTP server, such as a web server. Your HTTP server can run on an Amazon Elastic Compute Cloud (Amazon EC2) instance or on a server that you manage; these servers are also known as custom origins. 2. You upload your files to your origin servers. Your files, also known as objects, typically include web pages, images, and media files, but can be anything that can be served over HTTP. If you're using an Amazon S3 bucket as an origin server, you can make the objects in your bucket publicly readable, so that anyone who knows the CloudFront URLs for your objects can access them. You also have the option of keeping objects private and controlling who accesses them. See Serve private content with signed URLs and signed cookies. 3. You create a CloudFront distribution, which tells CloudFront which origin servers to get your files from when users request the files through your web site or application. At the same time, you specify details such as whether you want CloudFront to log all requests and whether you want the distribution to be enabled as soon as it's created. 4. CloudFront assigns a domain name to your new distribution that you can see in the CloudFront console, or that is returned in the response to a programmatic request, for example, an API request. If you like, you can add an alternate domain name to use instead. 5. CloudFront sends your distribution's configuration (but not your content) to all of its edge locations or points of presence (POPs)— collections of servers in geographically-dispersed data centers where CloudFront caches copies of your files. As you develop your website or application, you use the domain name that CloudFront provides for your URLs. For example, if CloudFront returns d111111abcdef8.cloudfront.net as the domain name for your distribution, the URL for logo.jpg in your Amazon S3 bucket (or in the root directory on an HTTP server) is https://d111111abcdef8.cloudfront.net/logo.jpg. Or you can set up CloudFront to use your own domain name with your distribution. In that case, the URL might be https://www.example.com/logo.jpg. How you set up CloudFront to deliver content 3 Amazon CloudFront Developer Guide Optionally, you can configure your origin server to add headers to the files, to indicate how long you want the files to stay in the cache in CloudFront edge locations. By default, each file stays in an edge location for 24 hours before it expires. The minimum expiration time is 0 seconds; there isn't a maximum expiration time. For more information, see Manage how long content stays in the cache (expiration). Pricing CloudFront charges for data transfers out from its edge locations, along with HTTP or HTTPS requests. Pricing varies by usage type, geographical region, and feature selection. The data transfer from your origin to CloudFront is always free when using AWS origins like Amazon Simple Storage Service (Amazon S3), Elastic Load Balancing, or Amazon API Gateway. You are only billed for the outbound data transfer from CloudFront to the viewer when using AWS origins. For more information, see CloudFront pricing and the Billing and Savings Bundle FAQs. Ways to use CloudFront Using CloudFront can help you accomplish a variety of goals. This section lists just a few, together with links to more information, to give you an idea of the possibilities. Topics • Accelerate static website content delivery • Serve video on demand or live streaming video • Encrypt specific fields throughout system processing |
AmazonCloudFront_DevGuide-007 | AmazonCloudFront_DevGuide.pdf | 7 | Simple Storage Service (Amazon S3), Elastic Load Balancing, or Amazon API Gateway. You are only billed for the outbound data transfer from CloudFront to the viewer when using AWS origins. For more information, see CloudFront pricing and the Billing and Savings Bundle FAQs. Ways to use CloudFront Using CloudFront can help you accomplish a variety of goals. This section lists just a few, together with links to more information, to give you an idea of the possibilities. Topics • Accelerate static website content delivery • Serve video on demand or live streaming video • Encrypt specific fields throughout system processing • Customize at the edge • Serve private content by using Lambda@Edge customizations Accelerate static website content delivery CloudFront can speed up the delivery of your static content (for example, images, style sheets, JavaScript, and so on) to viewers across the globe. By using CloudFront, you can take advantage of the AWS backbone network and CloudFront edge servers to give your viewers a fast, safe, and reliable experience when they visit your website. Pricing 4 Amazon CloudFront Developer Guide A simple approach for storing and delivering static content is to use an Amazon S3 bucket. Using S3 together with CloudFront has a number of advantages, including the option to use origin access control to easily restrict access to your Amazon S3 content. For more information about using Amazon S3 together with CloudFront, including an AWS CloudFormation template to help you get started quickly, see Get started with a secure static website. Serve video on demand or live streaming video CloudFront offers several options for streaming your media to global viewers—both pre-recorded files and live events. • For video on demand (VOD) streaming, you can use CloudFront to stream in common formats such as MPEG DASH, Apple HLS, Microsoft Smooth Streaming, and CMAF, to any device. • For broadcasting a live stream, you can cache media fragments at the edge, so that multiple requests for the manifest file that delivers the fragments in the right order can be combined, to reduce the load on your origin server. For more information about how to deliver streaming content with CloudFront, see Video on demand and live streaming video with CloudFront. Encrypt specific fields throughout system processing When you configure HTTPS with CloudFront, you already have secure end-to-end connections to origin servers. When you add field-level encryption, you can protect specific data throughout system processing in addition to HTTPS security, so that only certain applications at your origin can see the data. To set up field-level encryption, you add a public key to CloudFront, and then specify the set of fields that you want to be encrypted with the key. For more information, see Use field-level encryption to help protect sensitive data. Customize at the edge Running serverless code at the edge opens up a number of possibilities for customizing the content and experience for viewers, at reduced latency. For example, you can return a custom error message when your origin server is down for maintenance, so viewers don't get a generic Serve video on demand or live streaming video 5 Amazon CloudFront Developer Guide HTTP error message. Or you can use a function to help authorize users and control access to your content, before CloudFront forwards a request to your origin. Using Lambda@Edge with CloudFront enables a variety of ways to customize the content that CloudFront delivers. To learn more about Lambda@Edge and how to create and deploy functions with CloudFront, see Customize at the edge with Lambda@Edge. To see a number of code samples that you can customize for your own solutions, see Lambda@Edge example functions. Serve private content by using Lambda@Edge customizations Using Lambda@Edge can help you configure your CloudFront distribution to serve private content from your own custom origin, in addition to using signed URLs or signed cookies. To serve private content using CloudFront, you do the following: • Require that your users (viewers) access content using signed URLs or signed cookies. • Restrict access to your origin so that it's only available from CloudFront's origin-facing servers. To do this, you can do one of the following: • For an Amazon S3 origin, you can use an origin access control (OAC). • For a custom origin, you can do the following: • If the custom origin is protected by an Amazon VPC security group or AWS Firewall Manager, you can use the CloudFront managed prefix list to allow inbound traffic to your origin from only CloudFront's origin-facing IP addresses. • Use a custom HTTP header to restrict access to only requests from CloudFront. For more information, see the section called “Restrict access to files on custom origins” and the section called “Add custom headers to origin requests”. For an example that uses a custom header to restrict access to an |
AmazonCloudFront_DevGuide-008 | AmazonCloudFront_DevGuide.pdf | 8 | (OAC). • For a custom origin, you can do the following: • If the custom origin is protected by an Amazon VPC security group or AWS Firewall Manager, you can use the CloudFront managed prefix list to allow inbound traffic to your origin from only CloudFront's origin-facing IP addresses. • Use a custom HTTP header to restrict access to only requests from CloudFront. For more information, see the section called “Restrict access to files on custom origins” and the section called “Add custom headers to origin requests”. For an example that uses a custom header to restrict access to an Application Load Balancer origin, see the section called “Restrict access to Application Load Balancers”. • If the custom origin requires custom access control logic, you can use Lambda@Edge to implement that logic, as described in this blog post: Serving Private Content Using Amazon CloudFront & Lambda@Edge. How CloudFront delivers content After some initial setup, CloudFront works together with your website or application and speeds up delivery of your content. This section explains how CloudFront serves your content when viewers request it. Serve private content by using Lambda@Edge customizations 6 Amazon CloudFront Topics • How CloudFront delivers content to your users • How CloudFront works with regional edge caches Developer Guide How CloudFront delivers content to your users After you configure CloudFront to deliver your content, here’s what happens when users request your objects: 1. A user accesses your website or application and sends a request for an object, such as an image file or an HTML file. 2. DNS routes the request to the CloudFront POP (edge location) that can best serve the request, typically the nearest CloudFront POP in terms of latency. 3. CloudFront checks its cache for the requested object. If the object is in the cache, CloudFront returns it to the user. If the object is not in the cache, CloudFront does the following: a. CloudFront compares the request with the specifications in your distribution and forwards the request to your origin server for the corresponding object—for example, to your Amazon S3 bucket or your HTTP server. b. The origin server sends the object back to the edge location. c. As soon as the first byte arrives from the origin, CloudFront begins to forward the object to the user. CloudFront also adds the object to the cache for the next time someone requests it. How CloudFront delivers content to your users 7 Amazon CloudFront Developer Guide How CloudFront works with regional edge caches CloudFront points of presence (also known as POPs or edge locations) make sure that popular content can be served quickly to your viewers. CloudFront also has regional edge caches that bring more of your content closer to your viewers, even when the content is not popular enough to stay at a POP, to help improve performance for that content. Regional edge caches help with all types of content, particularly content that tends to become less popular over time. Examples include user-generated content, such as video, photos, or artwork; e-commerce assets such as product photos and videos; and news and event-related content that might suddenly find new popularity. How regional caches work Regional edge caches are CloudFront locations that are deployed globally, close to your viewers. They’re located between your origin server and the POPs—global edge locations that serve content directly to viewers. As objects become less popular, individual POPs might remove those objects to make room for more popular content. Regional edge caches have a larger cache than an individual POP, so objects remain in the cache longer at the nearest regional edge cache location. How CloudFront works with regional edge caches 8 Amazon CloudFront Developer Guide This helps keep more of your content closer to your viewers, reducing the need for CloudFront to go back to your origin server, and improving overall performance for viewers. When a viewer makes a request on your website or through your application, DNS routes the request to the POP that can best serve the user’s request. This location is typically the nearest CloudFront edge location in terms of latency. In the POP, CloudFront checks its cache for the requested object. If the object is in the cache, CloudFront returns it to the user. If the object is not in the cache, the POP typically goes to the nearest regional edge cache to fetch it. For more information about when the POP skips the regional edge cache and goes directly to the origin, see the following note. In the regional edge cache location, CloudFront again checks its cache for the requested object. If the object is in the cache, CloudFront forwards it to the POP that requested it. As soon as the first byte arrives from regional edge cache location, CloudFront begins to forward the object to the |
AmazonCloudFront_DevGuide-009 | AmazonCloudFront_DevGuide.pdf | 9 | CloudFront returns it to the user. If the object is not in the cache, the POP typically goes to the nearest regional edge cache to fetch it. For more information about when the POP skips the regional edge cache and goes directly to the origin, see the following note. In the regional edge cache location, CloudFront again checks its cache for the requested object. If the object is in the cache, CloudFront forwards it to the POP that requested it. As soon as the first byte arrives from regional edge cache location, CloudFront begins to forward the object to the user. CloudFront also adds the object to the cache in the POP for the next time someone requests it. For objects not cached at either the POP or the regional edge cache location, CloudFront compares the request with the specifications in your distributions and forwards the request to the origin server. After your origin server sends the object back to the regional edge cache location, it is forwarded to the POP, and then CloudFront forwards it to the user. In this case, CloudFront also adds the object to the cache in the regional edge cache location in addition to the POP for the next time a viewer requests it. This makes sure that all of the POPs in a region share a local cache, eliminating multiple requests to origin servers. CloudFront also keeps persistent connections with origin servers so objects are fetched from the origins as quickly as possible. Note • Regional edge caches have feature parity with POPs. For example, a cache invalidation request removes an object from both POP caches and regional edge caches before it expires. The next time a viewer requests the object, CloudFront returns to the origin to fetch the latest version of the object. • Proxy HTTP methods (PUT, POST, PATCH, OPTIONS, and DELETE) go directly to the origin from the POPs and do not proxy through the regional edge caches. • Dynamic requests, as determined at request time, do not flow through regional edge caches, but go directly to the origin. How CloudFront works with regional edge caches 9 Amazon CloudFront Developer Guide • When the origin is an Amazon S3 bucket and the request’s optimal regional edge cache is in the same AWS Region as the S3 bucket, the POP skips the regional edge cache and goes directly to the S3 bucket. The following diagram illustrates how requests and responses flow through CloudFront edge locations and regional edge caches. Locations and IP address ranges of CloudFront edge servers For a list of the locations of CloudFront edge servers, see the Amazon CloudFront Global Edge Network page. Amazon Web Services (AWS) publishes its current IP address ranges in JSON format. To view the current ranges, download ip-ranges.json. For more information, see AWS IP address ranges in the Amazon Web Services General Reference. To find the IP address ranges that are associated with CloudFront edge servers, search ip- ranges.json for the following string: "region": "GLOBAL", CloudFront edge servers 10 Amazon CloudFront "service": "CLOUDFRONT" Developer Guide Alternatively, you can view only the CloudFront IP ranges at https://d7uri8nf7uskq.cloudfront.net/ tools/list-cloudfront-ips. Use the CloudFront managed prefix list The CloudFront managed prefix list contains the IP address ranges of all of CloudFront's globally distributed origin-facing servers. If your origin is hosted on AWS and protected by an Amazon VPC security group, you can use the CloudFront managed prefix list to allow inbound traffic to your origin only from CloudFront's origin-facing servers, preventing any non-CloudFront traffic from reaching your origin. CloudFront maintains the managed prefix list so it's always up to date with the IP addresses of all of CloudFront's global origin-facing servers. With the CloudFront managed prefix list, you don't need to read or maintain a list of IP address ranges yourself. For example, imagine that your origin is an Amazon EC2 instance in the Europe (London) Region (eu-west-2). If the instance is in a VPC, you can create a security group rule that allows inbound HTTPS access from the CloudFront managed prefix list. This allows all of CloudFront's global origin-facing servers to reach the instance. If you remove all other inbound rules from the security group, you prevent any non-CloudFront traffic from reaching the instance. The CloudFront managed prefix list is named com.amazonaws.global.cloudfront.origin-facing. For more information, see Use an AWS-managed prefix list in the Amazon VPC User Guide. Important The CloudFront managed prefix list is unique in how it applies to Amazon VPC quotas. For more information, see AWS-managed prefix list weight in the Amazon VPC User Guide. Using CloudFront with an AWS SDK AWS software development kits (SDKs) are available for many popular programming languages. Each SDK provides an API, code examples, and documentation that make it easier for developers to build applications in their preferred language. |
AmazonCloudFront_DevGuide-010 | AmazonCloudFront_DevGuide.pdf | 10 | any non-CloudFront traffic from reaching the instance. The CloudFront managed prefix list is named com.amazonaws.global.cloudfront.origin-facing. For more information, see Use an AWS-managed prefix list in the Amazon VPC User Guide. Important The CloudFront managed prefix list is unique in how it applies to Amazon VPC quotas. For more information, see AWS-managed prefix list weight in the Amazon VPC User Guide. Using CloudFront with an AWS SDK AWS software development kits (SDKs) are available for many popular programming languages. Each SDK provides an API, code examples, and documentation that make it easier for developers to build applications in their preferred language. SDK documentation Code examples AWS SDK for C++ AWS SDK for C++ code examples Use the CloudFront managed prefix list 11 Amazon CloudFront Developer Guide SDK documentation Code examples AWS CLI AWS SDK for Go AWS SDK for Java AWS CLI code examples AWS SDK for Go code examples AWS SDK for Java code examples AWS SDK for JavaScript AWS SDK for JavaScript code examples AWS SDK for Kotlin AWS SDK for Kotlin code examples AWS SDK for .NET AWS SDK for PHP AWS SDK for .NET code examples AWS SDK for PHP code examples AWS Tools for PowerShell Tools for PowerShell code examples AWS SDK for Python (Boto3) AWS SDK for Python (Boto3) code examples AWS SDK for Ruby AWS SDK for Rust AWS SDK for Ruby code examples AWS SDK for Rust code examples AWS SDK for SAP ABAP AWS SDK for SAP ABAP code examples AWS SDK for Swift AWS SDK for Swift code examples Example availability Can't find what you need? Request a code example by using the Provide feedback link at the bottom of this page. CloudFront technical resources Use the following resources to get answers to technical questions about CloudFront: • AWS re:Post – A community-based question and answer site for developers to discuss technical questions related to CloudFront. CloudFront technical resources 12 Amazon CloudFront Developer Guide • Support Center – This site includes information about your recent support cases and results from AWS Trusted Advisor and health checks. It also provides links to discussion forums, technical FAQs, the service health dashboard, and information about Support plans. • AWS Premium Support – Learn about AWS Premium Support, a one-on-one, fast-response support channel that helps you build and run applications on AWS. • AWS IQ – Get help from AWS certified professionals and experts. CloudFront technical resources 13 Amazon CloudFront Developer Guide Get started with CloudFront The topics in this section show you how to get started delivering your content with Amazon CloudFront. The Set up your AWS account topic describes prerequisites for the following tutorials, such as creating an AWS account and creating a user with administrative access. The basic distribution tutorial shows you how to set up origin access control (OAC) to send authenticated requests to an Amazon S3 origin. The secure static website tutorial shows you how to create a secure static website for your domain name using OAC with an Amazon S3 origin. The tutorial uses an Amazon CloudFront (CloudFront) template for configuration and deployment. Topics • Set up your AWS account • Get started with a basic CloudFront distribution • Get started with a secure static website Set up your AWS account This topic describes preliminary steps, such as creating an AWS account, to prepare you to use Amazon CloudFront. Topics • Sign up for an AWS account • Create a user with administrative access • Choose how to access CloudFront Sign up for an AWS account If you do not have an AWS account, complete the following steps to create one. To sign up for an AWS account 1. Open https://portal.aws.amazon.com/billing/signup. Set up your AWS account 14 Amazon CloudFront Developer Guide 2. Follow the online instructions. Part of the sign-up procedure involves receiving a phone call and entering a verification code on the phone keypad. When you sign up for an AWS account, an AWS account root user is created. The root user has access to all AWS services and resources in the account. As a security best practice, assign administrative access to a user, and use only the root user to perform tasks that require root user access. AWS sends you a confirmation email after the sign-up process is complete. At any time, you can view your current account activity and manage your account by going to https://aws.amazon.com/ and choosing My Account. Create a user with administrative access After you sign up for an AWS account, secure your AWS account root user, enable AWS IAM Identity Center, and create an administrative user so that you don't use the root user for everyday tasks. Secure your AWS account root user 1. Sign in to the AWS Management Console as the account owner by choosing Root user and entering your |
AmazonCloudFront_DevGuide-011 | AmazonCloudFront_DevGuide.pdf | 11 | AWS sends you a confirmation email after the sign-up process is complete. At any time, you can view your current account activity and manage your account by going to https://aws.amazon.com/ and choosing My Account. Create a user with administrative access After you sign up for an AWS account, secure your AWS account root user, enable AWS IAM Identity Center, and create an administrative user so that you don't use the root user for everyday tasks. Secure your AWS account root user 1. Sign in to the AWS Management Console as the account owner by choosing Root user and entering your AWS account email address. On the next page, enter your password. For help signing in by using root user, see Signing in as the root user in the AWS Sign-In User Guide. 2. Turn on multi-factor authentication (MFA) for your root user. For instructions, see Enable a virtual MFA device for your AWS account root user (console) in the IAM User Guide. Create a user with administrative access 1. Enable IAM Identity Center. For instructions, see Enabling AWS IAM Identity Center in the AWS IAM Identity Center User Guide. 2. In IAM Identity Center, grant administrative access to a user. Create a user with administrative access 15 Amazon CloudFront Developer Guide For a tutorial about using the IAM Identity Center directory as your identity source, see Configure user access with the default IAM Identity Center directory in the AWS IAM Identity Center User Guide. Sign in as the user with administrative access • To sign in with your IAM Identity Center user, use the sign-in URL that was sent to your email address when you created the IAM Identity Center user. For help signing in using an IAM Identity Center user, see Signing in to the AWS access portal in the AWS Sign-In User Guide. Assign access to additional users 1. In IAM Identity Center, create a permission set that follows the best practice of applying least- privilege permissions. For instructions, see Create a permission set in the AWS IAM Identity Center User Guide. 2. Assign users to a group, and then assign single sign-on access to the group. For instructions, see Add groups in the AWS IAM Identity Center User Guide. Choose how to access CloudFront You can access Amazon CloudFront in the following ways: • AWS Management Console – The procedures throughout this guide explain how to use the AWS Management Console to perform tasks. • AWS SDKs – If you're using a programming language that AWS provides an SDK for, you can use an SDK to access CloudFront. SDKs simplify authentication, integrate easily with your development environment, and provide access to CloudFront commands. For more information, see Using CloudFront with an AWS SDK. • CloudFront API – If you're using a programming language that an SDK isn't available for, see the Amazon CloudFront API Reference for information about API actions and about how to make API requests. Choose how to access CloudFront 16 Amazon CloudFront Developer Guide • AWS CLI – The AWS Command Line Interface (AWS CLI) is a unified tool for managing AWS services. For information about how to install and configure the AWS CLI, see Install or update to the latest version of the AWS CLI in the AWS Command Line Interface User Guide. • Tools for Windows PowerShell – If you have experience with Windows PowerShell, you might prefer to use AWS Tools for Windows PowerShell. For more information, see Installing the AWS Tools for Windows PowerShell in the AWS Tools for Windows PowerShell User Guide. Get started with a basic CloudFront distribution The procedures in this section show you how to use CloudFront to set up a basic configuration that does the following: • Creates a bucket to use as your distribution origin. • Stores the original versions of your objects in an Amazon Simple Storage Service (Amazon S3) bucket. • Uses origin access control (OAC) to send authenticated requests to your Amazon S3 origin. OAC sends requests through CloudFront to prevent viewers from accessing your S3 bucket directly. For more information about OAC, see Restrict access to an Amazon S3 origin. • Uses the CloudFront domain name in URLs for your objects (for example, https:// d111111abcdef8.cloudfront.net/index.html). • Keeps your objects in CloudFront edge locations for the default duration of 24 hours (the minimum duration is 0 seconds). Most of these options are customizable. For information about how to customize your CloudFront distribution options, see Create a distribution. Topics • Prerequisites • Create an Amazon S3 bucket • Upload the content to the bucket • Create a CloudFront distribution that uses an Amazon S3 origin with OAC • Access your content through CloudFront • Clean up Get started with a basic distribution 17 Amazon CloudFront Developer Guide • Enhance your basic distribution |
AmazonCloudFront_DevGuide-012 | AmazonCloudFront_DevGuide.pdf | 12 | objects (for example, https:// d111111abcdef8.cloudfront.net/index.html). • Keeps your objects in CloudFront edge locations for the default duration of 24 hours (the minimum duration is 0 seconds). Most of these options are customizable. For information about how to customize your CloudFront distribution options, see Create a distribution. Topics • Prerequisites • Create an Amazon S3 bucket • Upload the content to the bucket • Create a CloudFront distribution that uses an Amazon S3 origin with OAC • Access your content through CloudFront • Clean up Get started with a basic distribution 17 Amazon CloudFront Developer Guide • Enhance your basic distribution Prerequisites Before you begin, make sure that you’ve completed the steps in Set up your AWS account. Create an Amazon S3 bucket An Amazon S3 bucket is a container for files (objects) or folders. CloudFront can distribute almost any type of file for you when an S3 bucket is the source. For example, CloudFront can distribute text, images, and videos. There is no maximum for the amount of data that you can store on Amazon S3. For this tutorial, you create an S3 bucket with the provided sample hello world files that you will use to create a basic webpage. To create a bucket 1. Sign in to the AWS Management Console and open the Amazon S3 console at https:// console.aws.amazon.com/s3/. 2. We recommend that you use our Hello World sample for this Getting started. Download the hello world webpage: hello-world-html.zip. Unzip it and save the css folder and index file in a convenient location, such as the desktop where you are running your browser. 3. Choose Create bucket. 4. 5. Enter a unique Bucket name that conforms to the General purpose buckets naming rules in the Amazon Simple Storage Service User Guide. For Region, we recommend choosing an AWS Region that is geographically close to you. (This reduces latency and costs.) • Choosing a different Region works, too. You might do this to address regulatory requirements, for example. 6. Leave all other settings at their defaults, and then choose Create bucket. Upload the content to the bucket After you create your Amazon S3 bucket, upload the contents of the unzipped hello world file to it. (You downloaded and unzipped this file in Create an Amazon S3 bucket.) Prerequisites 18 Amazon CloudFront Developer Guide To upload the content to Amazon S3 1. In the General purpose buckets section, choose the name of your new bucket. 2. Choose Upload. 3. On the Upload page, drag the css folder and index file into the drop area. 4. Leave all other settings at their defaults, and then choose Upload. Create a CloudFront distribution that uses an Amazon S3 origin with OAC For this tutorial, you will create a CloudFront distribution that uses an Amazon S3 origin with origin access control (OAC). OAC helps you securely send authenticated requests to your Amazon S3 origin. For more information about OAC, see Restrict access to an Amazon S3 origin. To create a CloudFront distribution with an Amazon S3 origin that uses OAC 1. Open the CloudFront console at https://console.aws.amazon.com/cloudfront/v4/home. 2. Choose Create distribution. 3. 4. 5. 6. 7. 8. For Origin, Origin domain, choose the S3 bucket that you created for this tutorial. For Origin, Origin access, select Origin access control settings (recommended). For Origin access control, choose Create new OAC. In the Create new OAC pane, keep the default settings and choose Create. For Web Application Firewall (WAF), select one of the options. For all other sections and settings, accept the default values. For more information about these options, see Distribution settings. 9. Choose Create distribution. 10. 11. In The S3 bucket policy needs to be updated banner, read the message and choose Copy policy. In the same banner, choose the link to Go to S3 bucket permissions to update policy. (This takes you to your bucket detail page in the Amazon S3 console.) 12. For Bucket policy, choose Edit. 13. In the Edit statement field, paste the policy that you copied in step 10. 14. Choose Save changes. Create distribution 19 Amazon CloudFront Developer Guide 15. Return to the CloudFront console and review the Details section for your new distribution. When your distribution is done deploying, the Last modified field changes from Deploying to a date and time. 16. Record the domain name that CloudFront assigns to your distribution. It looks similar to the following: d111111abcdef8.cloudfront.net. Before using the distribution and S3 bucket from this tutorial in a production environment, make sure to configure it to meet your specific needs. For information about configuring access in a production environment, see Configure secure access and restrict access to content. Access your content through CloudFront To access your content through CloudFront, combine the domain name for your CloudFront distribution with the main page for your content. |
AmazonCloudFront_DevGuide-013 | AmazonCloudFront_DevGuide.pdf | 13 | done deploying, the Last modified field changes from Deploying to a date and time. 16. Record the domain name that CloudFront assigns to your distribution. It looks similar to the following: d111111abcdef8.cloudfront.net. Before using the distribution and S3 bucket from this tutorial in a production environment, make sure to configure it to meet your specific needs. For information about configuring access in a production environment, see Configure secure access and restrict access to content. Access your content through CloudFront To access your content through CloudFront, combine the domain name for your CloudFront distribution with the main page for your content. (You recorded your distribution domain name in Create a CloudFront distribution that uses an Amazon S3 origin with OAC.) • Your distribution domain name might look like this: d111111abcdef8.cloudfront.net. • The path to the main page of a website is typically /index.html. Therefore, the URL to access your content through CloudFront might look like this: https://d111111abcdef8.cloudfront.net/index.html. If you followed the previous steps and used the hello world webpage, you should see a webpage that says Hello world!. When you upload more content to this S3 bucket, you can access the content through CloudFront by combining the CloudFront distribution domain name with the path to the object in the S3 bucket. For example, if you upload a new file named new-page.html to the root of your S3 bucket, the URL looks like this: https://d111111abcdef8.cloudfront.net/new-page.html. Clean up If you created your distribution and S3 bucket only as a learning exercise, delete them so that you no longer accrue charges. Delete the distribution first. For more information, see the following links: Access the content 20 Amazon CloudFront • Delete a distribution • Deleting a bucket Enhance your basic distribution Developer Guide This Get started tutorial provides a minimal framework for creating a distribution. We recommend that you explore the following enhancements: • By default, the files (objects) in the Amazon S3 bucket are set up as private. Only the AWS account that created the bucket has permission to read or write the files. If you want to allow anyone to access the files in your Amazon S3 bucket using CloudFront URLs, you must grant public read permissions to the objects. • You can use the CloudFront private content feature to restrict access to the content in the Amazon S3 buckets. For more information about distributing private content, see Serve private content with signed URLs and signed cookies. • You can configure your CloudFront distribution to use a custom domain name (for example, www.example.com instead of d111111abcdef8.cloudfront.net). For more information, see Use custom URLs. • This tutorial uses an Amazon S3 origin with origin access control (OAC). However, you can't use OAC if your origin is an S3 bucket configured as a website endpoint. If that's the case, you must set up your bucket with CloudFront as a custom origin. For more information, see Use an Amazon S3 bucket that's configured as a website endpoint. For more information about OAC, see Restrict access to an Amazon S3 origin. Get started with a secure static website You can get started with Amazon CloudFront by using the solution described in this topic to create a secure static website for your domain name. A static website uses only static files—like HTML, CSS, JavaScript, images, and videos—and doesn’t need servers or server-side processing. With this solution, your website gets the following benefits: • Uses the durable storage of Amazon Simple Storage Service (Amazon S3) – This solution creates an Amazon S3 bucket to host your static website’s content. To update your website, just upload your new files to the S3 bucket. • Is sped up by the Amazon CloudFront content delivery network – This solution creates a CloudFront distribution to serve your website to viewers with low latency. The distribution is Enhance your basic distribution 21 Amazon CloudFront Developer Guide configured with origin access control (OAC) to make sure that the website is accessible only through CloudFront, not directly from S3. • Is secured by HTTPS and security headers – This solution creates an SSL/TLS certificate in AWS Certificate Manager (ACM), and attaches it to the CloudFront distribution. This certificate enables the distribution to serve your domain’s website securely with HTTPS. • Is configured and deployed with AWS CloudFormation – This solution uses an AWS CloudFormation template to set up all the components, so you can focus more on your website’s content and less on configuring components. This solution is open source on GitHub. To view the code, submit a pull request, or open an issue, go to https://github.com/aws-samples/amazon-cloudfront-secure-static-site. Topics • Solution overview • Deploy the solution Solution overview The following diagram shows an overview of how this static website solution works: 1. The viewer requests the website at www.example.com. 2. If the requested object is cached, CloudFront |
AmazonCloudFront_DevGuide-014 | AmazonCloudFront_DevGuide.pdf | 14 | securely with HTTPS. • Is configured and deployed with AWS CloudFormation – This solution uses an AWS CloudFormation template to set up all the components, so you can focus more on your website’s content and less on configuring components. This solution is open source on GitHub. To view the code, submit a pull request, or open an issue, go to https://github.com/aws-samples/amazon-cloudfront-secure-static-site. Topics • Solution overview • Deploy the solution Solution overview The following diagram shows an overview of how this static website solution works: 1. The viewer requests the website at www.example.com. 2. If the requested object is cached, CloudFront returns the object from its cache to the viewer. 3. If the object is not in the CloudFront cache, CloudFront requests the object from the origin (an S3 bucket). 4. S3 returns the object to CloudFront. 5. CloudFront caches the object. Solution overview 22 Amazon CloudFront Developer Guide 6. The objects is returned to the viewer. Subsequent requests for the object that come to the same CloudFront edge location are served from the CloudFront cache. Deploy the solution To deploy this secure static website solution, you can choose from either of the following options: • Use the AWS CloudFormation console to deploy the solution with default content, then upload your website content to Amazon S3. • Clone the solution to your computer to add your website content. Then, deploy the solution with the AWS Command Line Interface (AWS CLI). Note You must use the US East (N. Virginia) Region to deploy the CloudFormation template. Topics • Prerequisites • Use the AWS CloudFormation console • Clone the solution locally • Finding access logs Prerequisites To use this solution, you must have the following prerequisites: • A registered domain name, such as example.com, that’s pointed to an Amazon Route 53 hosted zone. The hosted zone must be in the same AWS account where you deploy this solution. If you don’t have a registered domain name, you can register one with Route 53. If you have a registered domain name but it’s not pointed to a Route 53 hosted zone, configure Route 53 as your DNS service. • AWS Identity and Access Management (IAM) permissions to launch CloudFormation templates that create IAM roles, and permissions to create all the AWS resources in the solution. For more information, see Controlling access with AWS Identity and Access Management in the AWS CloudFormation User Guide. Deploy the solution 23 Amazon CloudFront Developer Guide You are responsible for the costs incurred while using this solution. For more information about costs, see the pricing pages for each AWS service. Use the AWS CloudFormation console To deploy using the CloudFormation console 1. Launch this solution in the AWS CloudFormation console. If necessary, sign in to your AWS account. 2. The Create stack wizard opens in the CloudFormation console, with prepopulated fields that specify this solution’s CloudFormation template. At the bottom of the page, choose Next. 3. On the Specify stack details page, enter values for the following fields: • SubDomain – Enter the subdomain to use for your website. For example, if the subdomain is www, your website is available at www.example.com. (Replace example.com with your domain name, as explained in the following bullet.) • DomainName – Enter your domain name, such as example.com. This domain must be pointed to a Route 53 hosted zone. • HostedZoneId – The Route 53 hosted zone ID of your domain name. • CreateApex – (Optional) Create an alias to the domain apex (example.com) in your CloudFront configuration. 4. When finished, choose Next. 5. (Optional) On the Configure stack options page, add tags and other stack options. 6. When finished, choose Next. 7. On the Review page, scroll to the bottom of the page, then select the two boxes in the Capabilities section. These capabilities allow CloudFormation to create an IAM role that allows access to the stack’s resources, and to name the resources dynamically. 8. Choose Create stack. 9. Wait for the stack to finish creating. The stack creates some nested stacks, and can take several minutes to finish. When it’s finished, the Status changes to CREATE_COMPLETE. When the status is CREATE_COMPLETE, go to https://www.example.com to view your website (replace www.example.com with the subdomain and domain name that you specified in step 3). You should see the website’s default content: Deploy the solution 24 Amazon CloudFront Developer Guide To replace the website’s default content with your own 1. Open the Amazon S3 console at https://console.aws.amazon.com/s3/. 2. Choose the bucket whose name begins with amazon-cloudfront-secure-static-site- s3bucketroot-. Note Make sure to choose the bucket with s3bucketroot in its name, not s3bucketlogs. The bucket with s3bucketroot in its name contains the website content. The one with s3bucketlogs contains only log files. 3. Delete the website’s default content, then upload your own. Note If you viewed |
AmazonCloudFront_DevGuide-015 | AmazonCloudFront_DevGuide.pdf | 15 | the subdomain and domain name that you specified in step 3). You should see the website’s default content: Deploy the solution 24 Amazon CloudFront Developer Guide To replace the website’s default content with your own 1. Open the Amazon S3 console at https://console.aws.amazon.com/s3/. 2. Choose the bucket whose name begins with amazon-cloudfront-secure-static-site- s3bucketroot-. Note Make sure to choose the bucket with s3bucketroot in its name, not s3bucketlogs. The bucket with s3bucketroot in its name contains the website content. The one with s3bucketlogs contains only log files. 3. Delete the website’s default content, then upload your own. Note If you viewed your website with this solution’s default content, then it’s likely that some of the default content is cached in a CloudFront edge location. To make sure that viewers see your updated website content, invalidate the files to remove the cached copies from CloudFront edge locations. For more information, see Invalidate files to remove content. Clone the solution locally Prerequisites To add your website content before deploying this solution, you must package the solution’s artifacts locally, which requires Node.js and npm. For more information, see https:// www.npmjs.com/get-npm. Deploy the solution 25 Amazon CloudFront Developer Guide To add your website content and deploy the solution 1. Clone or download the solution from https://github.com/aws-samples/amazon-cloudfront- secure-static-site. After you clone or download it, open a command prompt or terminal and navigate to the amazon-cloudfront-secure-static-site folder. 2. Run the following command to install and package the solution’s artifacts: make package-static 3. Copy your website’s content into the www folder, overwriting the default website content. 4. Run the following AWS CLI command to create an Amazon S3 bucket to store the solution’s artifacts. Replace amzn-s3-demo-bucket-for-artifacts with your own bucket name. aws s3 mb s3://amzn-s3-demo-bucket-for-artifacts --region us-east-1 5. Run the following AWS CLI command to package the solution’s artifacts as a CloudFormation template. Replace amzn-s3-demo-bucket-for-artifacts with the name of the bucket that you created in the previous step. aws cloudformation package \ --region us-east-1 \ --template-file templates/main.yaml \ --s3-bucket amzn-s3-demo-bucket-for-artifacts \ --output-template-file packaged.template 6. Run the following command to deploy the solution with CloudFormation, replacing the following values: • your-CloudFormation-stack-name – Replace with a name for the CloudFormation stack. • example.com – Replace with your domain name. This domain must be pointed to a Route 53 hosted zone in the same AWS account. • www – Replace with the subdomain to use for your website. For example, if the subdomain is www, your website is available at www.example.com. • hosted-zone-ID – Replace with the Route 53 hosted zone ID of your domain name. aws cloudformation deploy \ --region us-east-1 \ Deploy the solution 26 Amazon CloudFront Developer Guide --stack-name your-CloudFormation-stack-name \ --template-file packaged.template \ --capabilities CAPABILITY_NAMED_IAM CAPABILITY_AUTO_EXPAND \ --parameter-overrides DomainName=example.com SubDomain=www HostedZoneId=hosted- zone-ID • (Optional) To deploy the stack with a domain apex, run the following command instead. aws --region us-east-1 cloudformation deploy \ --stack-name your-CloudFormation-stack-name \ --template-file packaged.template \ --capabilities CAPABILITY_NAMED_IAM CAPABILITY_AUTO_EXPAND \ --parameter-overrides DomainName=example.com SubDomain=www HostedZoneId=hosted-zone-ID CreateApex=yes 7. Wait for the CloudFormation stack to finish creating. The stack creates some nested stacks, and can take several minutes to finish. When it’s finished, the Status changes to CREATE_COMPLETE. When the status changes to CREATE_COMPLETE, go to https://www.example.com to view your website (replace www.example.com with the subdomain and domain name that you specified in the previous step). You should see your website’s content. Finding access logs This solution enables access logs for the CloudFront distribution. Complete the following steps to locate the distribution’s access logs. To locate the distribution’s access logs 1. Open the Amazon S3 console at https://console.aws.amazon.com/s3/. 2. Choose the bucket whose name begins with amazon-cloudfront-secure-static-site- s3bucketlogs-. Note Make sure to choose the bucket with s3bucketlogs in its name, not s3bucketroot. The bucket with s3bucketlogs in its name contains log files. The one with s3bucketroot contains the website content. Deploy the solution 27 Amazon CloudFront Developer Guide 3. The folder named cdn contains the CloudFront access logs. Deploy the solution 28 Amazon CloudFront Developer Guide Configure distributions You create an Amazon CloudFront distribution to tell CloudFront from where you want content to be delivered, and the details about how to track and manage content delivery. You can create CloudFront multi-tenant distributions with settings that can be reused across multiple distribution tenants. With a multi-tenant distribution, you can have CloudFront configure your distribution settings for you, based on your content origin type. For more details about the preconfigured settings, see CloudFront multi-tenant distribution reference. You can also create distributions with settings that can be reused across multiple distribution tenants. For more information, see Understand how multi-tenant distributions work. Alternatively, you can use a standard distribution and manually configure your own distribution settings. The following settings can be configured: • Your content origin—The Amazon S3 bucket, AWS Elemental MediaPackage channel, AWS Elemental MediaStore container, Elastic Load Balancing load |
AmazonCloudFront_DevGuide-016 | AmazonCloudFront_DevGuide.pdf | 16 | reused across multiple distribution tenants. With a multi-tenant distribution, you can have CloudFront configure your distribution settings for you, based on your content origin type. For more details about the preconfigured settings, see CloudFront multi-tenant distribution reference. You can also create distributions with settings that can be reused across multiple distribution tenants. For more information, see Understand how multi-tenant distributions work. Alternatively, you can use a standard distribution and manually configure your own distribution settings. The following settings can be configured: • Your content origin—The Amazon S3 bucket, AWS Elemental MediaPackage channel, AWS Elemental MediaStore container, Elastic Load Balancing load balancer, or HTTP server from which CloudFront gets the files to distribute. You can specify any combination of up to 25 origins for a single distribution. • Access—Whether you want access to the files to be available to everyone or restricted to some users. • Security—Whether you want to enable AWS WAF protection and require users to use HTTPS to access your content. For multi-tenant distributions, only AWS WAF V2 web access control lists (ACLs) are supported. • Cache key—Which values, if any, you want to include in the cache key. The cache key uniquely identifies each file in the cache for a given distribution. • Origin request settings—Whether you want CloudFront to include HTTP headers, cookies, or query strings in requests that it sends to your origin. • Geographic restrictions—Whether you want CloudFront to prevent users in selected countries from accessing your content. • Logs—Whether you want CloudFront to create standard logs or real-time logs that show viewer activity. For more information, see Distribution settings reference. 29 Amazon CloudFront Developer Guide For the current maximum number of distributions that you can create for each AWS account, see General quotas on distributions. There is no maximum number of files that you can serve per distribution. You can use distributions to serve the following content over HTTP or HTTPS: • Static and dynamic download content, such as HTML, CSS, JavaScript, and image files, using HTTP or HTTPS. • Video on demand in different formats, such as Apple HTTP Live Streaming (HLS) and Microsoft Smooth Streaming. (For multi-tenant distributions, Smooth Streaming is not supported.) For more information, see Deliver video on demand with CloudFront. • A live event, such as a meeting, conference, or concert, in real time. For live streaming, you can create the distribution automatically by using an AWS CloudFormation stack. For more information, see Deliver video streaming with CloudFront and AWS Media Services. The following topics provide more details about CloudFront distributions and how to configure them to meet your business needs. For more information about creating a distribution, see Create a distribution. Topics • Understand how multi-tenant distributions work • Create a distribution • Distribution settings reference • Test a distribution • Update a distribution • Tag a distribution • Delete a distribution • Use various origins with CloudFront distributions • Use CloudFront continuous deployment to safely test CDN configuration changes • Use custom URLs by adding alternate domain names (CNAMEs) • Use WebSockets with CloudFront distributions • Request Anycast static IPs to use for allowlisting • Using gRPC with CloudFront distributions 30 Amazon CloudFront Developer Guide Understand how multi-tenant distributions work You can create CloudFront multi-tenant distributions with settings that can be reused across multiple distribution tenants. With a multi-tenant distribution, you can have CloudFront configure your distribution settings for you, based on your content origin type. For more details about the preconfigured settings, see CloudFront multi-tenant distribution reference. Benefits of using a multi-tenant distribution instead of a standard distribution include: • Reducing operational burden. • Reusable configurations for web admins and software providers to manage CloudFront distribution for multiple web applications that deliver content to end users. • Enhanced integrations with other AWS services to deliver automated certificate management, unified security controls, and hassle-free configuration control at scale. • Maintaining consistent resource patterns across your implementations. Define settings that must be shared and then specify customizations for settings to override. • Customizable origin and security settings to meet specific needs at the distribution tenant level. • Organize your distribution tenants into different tiers. For example, if some distribution tenants require Origin Shield and some do not, you can group distribution tenants into different multi- tenant distributions. • Sharing a common DNS configuration across multiple domains. Unlike a standard distribution, a multi-tenant distribution cannot be accessed directly because it has no CloudFront routing endpoint. Therefore, it must be used in conjunction with a connection group and one or more distribution tenants. While standard distributions have their own CloudFront endpoint and can be directly accessed by end users, they cannot be used as a template for other distributions. For information about multi-tenant distribution quotas, see Quotas on multi-tenant distributions. Topics • How it works • Terms • Unsupported |
AmazonCloudFront_DevGuide-017 | AmazonCloudFront_DevGuide.pdf | 17 | you can group distribution tenants into different multi- tenant distributions. • Sharing a common DNS configuration across multiple domains. Unlike a standard distribution, a multi-tenant distribution cannot be accessed directly because it has no CloudFront routing endpoint. Therefore, it must be used in conjunction with a connection group and one or more distribution tenants. While standard distributions have their own CloudFront endpoint and can be directly accessed by end users, they cannot be used as a template for other distributions. For information about multi-tenant distribution quotas, see Quotas on multi-tenant distributions. Topics • How it works • Terms • Unsupported features • CloudFront multi-tenant distribution reference • Distribution tenant customizations Understand how multi-tenant distributions work 31 Amazon CloudFront Developer Guide • Request certificates for your CloudFront distribution tenant • Create custom connection group (optional) How it works In a standard distribution, the distribution contains all the settings that you want to enable for your website or application, such as the origin configurations, cache behaviors, and security settings. If you wanted to create a separate website and use many of the same settings, you would need to create a new distribution each time. CloudFront multi-tenant distributions are different in that you can create an initial multi-tenant distribution. For each new website, you create a distribution tenant that automatically inherits the defined values of its source distribution. Then, you customize specific settings for your distribution tenant. Overview 1. To get started, you first create a multi-tenant distribution. CloudFront configures your distribution settings for you, based on your content origin type. You can customize settings for all origins except VPC origins. VPC origins settings are customized on the VPC origin resource itself. For more information about the multi-tenant distribution settings that you can customize, see CloudFront multi-tenant distribution reference. • The TLS certificate that you use for the multi-tenant distribution can be inherited by your distribution tenants. The multi-tenant distribution itself is not routable, so it will not have a domain name associated with it. 2. By default, CloudFront creates a connection group for you. The connection group controls how viewer requests for content connect to CloudFront. You can customize some routing settings in the connection group. You can change this by manually creating your own connection group. For more information, see Create custom connection group (optional). 3. Then, you create one or more distribution tenants. The distribution tenant is the "front door" for viewers to access your content. Each distribution tenant references the multi-tenant distribution and is automatically associated with the connection group that CloudFront created for you. The distribution tenant supports an individual domain or subdomain. 4. You can then customize some distribution tenant settings, such as vanity domains and origin paths. For more information, see Distribution tenant customizations. How it works 32 Amazon CloudFront Developer Guide 5. Finally, you must update the DNS record in your DNS host to route traffic to the distribution tenant. To do this, get the CloudFront endpoint value from your connection group and create a CNAME record that points to the CloudFront endpoint. Example Example The following graphic demonstrates how a multi-tenant distribution,distribution tenants, and connection groups work together to deliver content for your viewers for multiple domains. 1. The multi-tenant distribution defines the inherited settings for each distribution tenant. You use the multi-tenant distribution as a template. 2. Each distribution tenant created from the multi-tenant distribution has its own domain. 3. The distribution tenants are automatically added to the connection group that CloudFront created for you when you created the multi-tenant distribution. Connection groups control how viewer requests are connected to the CloudFront network. How it works 33 Amazon CloudFront Developer Guide For detailed multi-tenant distribution creation instructions, see Create a CloudFront distribution in the console. Terms The following concepts describe components of multi-tenant distributions: Multi-tenant distribution A blueprint, multi-tenant distribution that specifies all shared configuration settings for any distribution tenants, including cache behavior, security protections, and origins. Multi-tenant distributions cannot serve traffic directly. They must be used in conjunction with connection groups and distribution tenants. Standard distribution A distribution that does not have multi-tenant functionality. These distributions are best for supporting single websites or apps. Distribution tenant A distribution tenant inherits the multi-tenant distribution configuration. It supports up to five individual domains or subdomains. Some configuration settings can be customized at the distribution tenant level. The distribution tenant must have a valid TLS certificate, which can be inherited from the multi-tenant distribution as long as it covers the distribution tenant domain or subdomain. The distribution tenant must be associated with a connection group. CloudFront creates a connection group for you when you create a distribution tenant, and automatically assigns any distribution tenants to that connection group. Multi-tenancy You can use the multi-tenant distribution to serve content across multiple domains, while sharing configuration and |
AmazonCloudFront_DevGuide-018 | AmazonCloudFront_DevGuide.pdf | 18 | distribution configuration. It supports up to five individual domains or subdomains. Some configuration settings can be customized at the distribution tenant level. The distribution tenant must have a valid TLS certificate, which can be inherited from the multi-tenant distribution as long as it covers the distribution tenant domain or subdomain. The distribution tenant must be associated with a connection group. CloudFront creates a connection group for you when you create a distribution tenant, and automatically assigns any distribution tenants to that connection group. Multi-tenancy You can use the multi-tenant distribution to serve content across multiple domains, while sharing configuration and infrastructure. This approach allows different domains (called tenants) to share common settings from the multi-tenant distribution, while maintaining their own customizations. Connection group Provides the CloudFront routing endpoint that serves content to viewers. You must associate each distribution tenant to a connection group to get the corresponding CloudFront routing Terms 34 Amazon CloudFront Developer Guide endpoint for the CNAME record that you create for your distribution tenant domain or subdomain. Connection groups can be shared across multiple distribution tenants. Connection groups manage routing settings for distribution tenants, such as IPv6 and Anycast IP list settings. Parameters A list of key-value pairs for placeholder values, such as origin paths and domain names. You can define parameters in your multi-tenant distribution and provide values for those parameters at the distribution tenant level. You choose whether the parameter values are required to be entered for the distribution tenant. If you do not provide a value for an optional parameter in a distribution tenant, then the default value from the multi-tenant distribution is used as the value. CloudFront routing endpoint Canonical DNS for the connection group, such as d123.cloudfront.net. Used in the CNAME record for your distribution tenant domain or subdomain. Customizations You can customize your distribution tenants so that they use different settings from the multi- tenant distribution. For each distribution tenant, you can specify a different AWS WAF web access control list (ACL), TLS certificates, and geographic restrictions. Unsupported features The following features can't be used with a multi-tenant distribution. If you want to create a new multi-tenant distribution using the same settings as your standard distribution, note that some settings aren't available. Notes • Currently, AWS Firewall Manager policies only apply to your standard distributions. Firewall Manager will add support for multi-tenant distributions in a future release. • Unlike standard distributions, you specify your domain name (alias) at the distribution tenant level. For more information, see Request certificates for your CloudFront distribution tenant and the CreateDistributionTenant API operation. Unsupported features 35 Amazon CloudFront • Continuous deployment Developer Guide • Origin access identity (OAI) – Use origin access control (OAC) instead. • Dedicated IP custom SSL support – Only the sni-only method is supported. • AWS WAF Classic (V1) web ACL – Only AWS WAF V2 web ACLs are supported. • Standard logging (legacy) • Minimum TTL • Default TTL • Maximum TTL • ForwardedValues • Trusted Signers • Smooth streaming • AWS Identity and Access Management (IAM) server certificates • Dedicated IP addresses • Minimum Protocol Version SSLv3 The following settings can't be configured in a multi-tenant distribution or distribution tenant. Instead, set the values that you want in a connection group. All distribution tenants associated in the connection group will use these settings. For more information, see Create custom connection group (optional). • Enable IPv6 • Anycast static IP list CloudFront multi-tenant distribution reference With a multi-tenant distribution, you can have CloudFront configure most distribution settings for you, based on your content origin type. For more information about multi-tenant distributions, see Understand how multi-tenant distributions work. The following sections describe the default preconfiguration settings for multi-tenant distributions, and the settings that you can customize. CloudFront multi-tenant distribution reference 36 Amazon CloudFront Amazon S3 origin Developer Guide Following are the origin settings that CloudFront preconfigures for your Amazon S3 origin in a multi-tenant distribution. Origin settings (preconfigured) • Origin Access Control (console only) – CloudFront sets this up for you. For multi-tenant distributions with no parameters used in the origin domain, CloudFront attempts to add the S3 bucket policy. • Add custom header – None • Enable Origin Shield – No • Connection attempts – 3 Following are the cache settings that CloudFront preconfigures for your Amazon S3 origin in a multi-tenant distribution. Cache settings (preconfigured) • Compress objects automatically – Yes • Viewer protocol policy – Redirect to HTTPS • Allowed HTTP method – GET, HEAD • Restrict viewer access – No • Cache policy – CachingOptimized • Origin request policy – None • Response header policy – SecurityHeadersPolicy • Smooth Streaming – No • Field level encryption – No • Enable real-time logs – No • Functions – No Following are the settings that you can customize for your |
AmazonCloudFront_DevGuide-019 | AmazonCloudFront_DevGuide.pdf | 19 | • Connection attempts – 3 Following are the cache settings that CloudFront preconfigures for your Amazon S3 origin in a multi-tenant distribution. Cache settings (preconfigured) • Compress objects automatically – Yes • Viewer protocol policy – Redirect to HTTPS • Allowed HTTP method – GET, HEAD • Restrict viewer access – No • Cache policy – CachingOptimized • Origin request policy – None • Response header policy – SecurityHeadersPolicy • Smooth Streaming – No • Field level encryption – No • Enable real-time logs – No • Functions – No Following are the settings that you can customize for your Amazon S3 origin in a multi-tenant distribution. CloudFront multi-tenant distribution reference 37 Amazon CloudFront Customizable settings Developer Guide • S3 access – CloudFront sets this for you, based on your S3 bucket settings: • If your bucket is public – No Origin Access Control (OAC) policy is needed. • If your bucket is private – You can choose or create an OAC policy to use. • Enable Origin Shield – No • Compress objects automatically – Yes • If you choose Yes, then the CachingOptimized caching policy is used. • If you choose No, then the CachingOptimizedForUncompressedObjects caching policy is used. API Gateway origin Following are the origin settings that CloudFront preconfigures for your API Gateway origin in a multi-tenant distribution. Origin settings (preconfigured) • Protocol – HTTPS only • HTTPS port – 443 • Minimum origin SSL protocol – TLSv1.2 • Origin path – None • Origin Access Control (console only) – CloudFront sets this up for you • Add custom header – None • Enable Origin Shield – No • Connection attempts – 3 • Response timeout – 30 • Keep-alive timeout – 5 Following are the cache settings that CloudFront preconfigures for your API Gateway origin in a multi-tenant distribution. Cache settings (preconfigured) • Compress objects automatically – Yes CloudFront multi-tenant distribution reference 38 Amazon CloudFront Developer Guide • Viewer protocol policy – Redirect to HTTPS • Allowed HTTP method – GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE • Cache HTTP methods – No • Allow gRPC requests over HTTP/2 – No • Restrict viewer access – No • Cache policy – CachingDisabled (Possible values: UseOriginCacheControlHeaders, UseOriginCacheControlHeaders-QueryStrings) • Origin request policy – AllViewerExceptHostHeader (Possible values: AllViewer, AllViewerandCloudFrontHeaders-2022-06) • Response header policy – SecurityHeadersPolicy • Smooth Streaming – No • Field level encryption – No • Enable real-time logs – No • Functions – No Following are the settings that you can customize for your API Gateway origin in a multi-tenant distribution. Customizable settings • Enable Origin Shield – (Default: No) • Compress objects automatically – (Default: Yes) Custom origin and EC2 instance Following are the origin settings that CloudFront preconfigures for your custom origin in a multi- tenant distribution. Origin settings (preconfigured) • Protocol – Match viewer • HTTP port – 80 • HTTPS port – 443 • Minimum origin SSL protocol – TLSv1.2 • Origin path – None CloudFront multi-tenant distribution reference 39 Amazon CloudFront • Add custom header – None • Enable Origin Shield – No • Connection attempts – 3 • Response timeout – 30 • Keep-alive timeout – 5 Developer Guide Following are the cache settings that CloudFront preconfigures for your custom origin and EC2 instance in a multi-tenant distribution. Cache settings (preconfigured) • Compress objects automatically – Yes • Viewer protocol policy – Redirect to HTTPS • Allowed HTTP method – GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE • Cache HTTP methods – No • Allow gRPC requests over HTTP/2 – No • Restrict viewer access – No • Cache policy – UseOriginCacheControlHeaders (Possible values: UseOriginCacheControlHeaders-QueryStrings, CachingDisabled, CacheOptimized, CachingOptimizedForUncompressedObjects) • Origin request policy – AllViewer (Possible values: AllViewerExceptHostHeader, AllViewerandCloudFrontHeaders-2022-06) • Response header policy – SecurityHeadersPolicy • Smooth Streaming – No • Field level encryption – No • Enable real-time logs – No • Functions – No Following are the settings that you can customize for your custom origin and EC2 instance in a multi-tenant distribution. Customizable settings • Enable Origin Shield – (Default: No) CloudFront multi-tenant distribution reference 40 Amazon CloudFront Developer Guide • Compress objects automatically – (Default: Yes) • Caching – (Default: Cache by Default) • If Cache by Default is selected, the UseOriginCacheControlHeaders cache policy is used. • If Do Not Cache by Default is selected, the CachingDisabled cache policy is used. • Include query string in cache – (Default: Yes, if Cache by Default is already selected) • If Do Not Cache by Default is already selected and you then choose to include the query string in the cache, the UseOriginCacheControlHeaders-QueryStrings cache policy is used. Elastic Load Balancing origin Following are the origin settings that CloudFront preconfigures for your Elastic Load Balancing origin in a multi-tenant distribution. Origin settings (preconfigured) • Protocol – HTTPS only • HTTPS port |
AmazonCloudFront_DevGuide-020 | AmazonCloudFront_DevGuide.pdf | 20 | is selected, the UseOriginCacheControlHeaders cache policy is used. • If Do Not Cache by Default is selected, the CachingDisabled cache policy is used. • Include query string in cache – (Default: Yes, if Cache by Default is already selected) • If Do Not Cache by Default is already selected and you then choose to include the query string in the cache, the UseOriginCacheControlHeaders-QueryStrings cache policy is used. Elastic Load Balancing origin Following are the origin settings that CloudFront preconfigures for your Elastic Load Balancing origin in a multi-tenant distribution. Origin settings (preconfigured) • Protocol – HTTPS only • HTTPS port – 443 • Minimum origin SSL protocol – TLSv1.2 • Origin path – None • Add custom header – None • Enable Origin Shield – No • Connection attempts – 3 • Response timeout – 30 • Keep-alive timeout – 5 Following are the cache settings that CloudFront preconfigures for your Elastic Load Balancing origin in a multi-tenant distribution. Cache settings (preconfigured) • Compress objects automatically – Yes • Viewer protocol policy – Redirect to HTTPS CloudFront multi-tenant distribution reference 41 Amazon CloudFront Developer Guide • Allowed HTTP method – GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE • Cache HTTP methods – No • Allow gRPC requests over HTTP/2 – No • Restrict viewer access – No • Caching – (Default: Cache by Default) • If Cache by Default is selected, the UseOriginCacheControlHeaders cache policy is used. • If Do Not Cache by Default is selected, the CachingDisabled cache policy is used. • Include query string in cache – (Default: Yes, if Cache by Default is already selected) • If Do Not Cache by Default is already selected and you then choose to include the query string in the cache, the UseOriginCacheControlHeaders-QueryStrings cache policy is used. • Origin request policy – All Viewer (Possible values: AllViewerExceptHostHeader, AllViewerandCloudFrontHeaders-2022-06) • Response header policy – SecurityHeadersPolicy • Smooth Streaming – No • Field level encryption – No • Enable real-time logs – No • Functions – No Following are the settings that you can customize for your Elastic Load Balancing origin in a multi- tenant distribution. Customizable settings • Enable Origin Shield – (Default: No) • Compress objects automatically – (Default: Yes) • Caching – (Default: Cache by Default) • If Cache by Default is selected, the UseOriginCacheControlHeaders cache policy is used. • If Do Not Cache by Default is selected, the CachingDisabled cache policy is used. • Include query string in cache – (Default: Yes, if Cache by Default is already selected) CloudFront multi-tenant distribution reference 42 Amazon CloudFront Developer Guide • If Do Not Cache by Default is already selected and you then choose to include the query string in the cache, the UseOriginCacheControlHeaders-QueryStrings cache policy is used. Lambda function URL origin Following are the origin settings that CloudFront preconfigures for your Lambda function URL origin in a multi-tenant distribution. Origin settings (preconfigured) • Origin Access Control – CloudFront sets this up for you and adds the policy • Protocol – HTTPS only • HTTPS port – 443 • Minimum origin SSL protocol – TLSv1.2 • Origin path – None • Add custom header – None • Enable Origin Shield – No • Connection attempts – 3 • Response timeout – 30 • Keep-alive timeout – 5 Following are the cache settings that CloudFront preconfigures for your Lambda function URL origin in a multi-tenant distribution. Cache settings (preconfigured) • Compress objects automatically – Yes • Viewer protocol policy – Redirect to HTTPS • Allowed HTTP method – GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE • Cache HTTP methods – No • Allow gRPC requests over HTTP/2 – No • Restrict viewer access – No CloudFront multi-tenant distribution reference 43 Amazon CloudFront Developer Guide • Cache policy – CachingDisabled (Possible values: UseOriginCacheControlHeaders, UseOriginCacheControlHeaders-QueryStrings) • Origin request policy – AllViewerExceptHostHeader • Response header policy – SecurityHeadersPolicy • Smooth Streaming – No • Field level encryption – No • Enable real-time logs – No • Functions – No Following are the settings that you can customize for your Lambda function URL origin in a multi- tenant distribution. Customizable settings • Enable Origin Shield – (Default: No) • Compress objects automatically – (Default: Yes) • Caching – (Default: Cache by Default) • If Cache by Default is selected, the UseOriginCacheControlHeaders cache policy is used. • If Do Not Cache by Default is selected, the CachingDisabled cache policy is used. • Include query string in cache – (Default: Yes, if Cache by Default is already selected) • If Do Not Cache by Default is already selected and you then choose to include the query string in the cache, the UseOriginCacheControlHeaders-QueryStrings cache policy is used. MediaPackage v1 origin Following are the origin settings that CloudFront preconfigures for your MediaPackage v1 origin in a multi-tenant distribution. Origin settings |
AmazonCloudFront_DevGuide-021 | AmazonCloudFront_DevGuide.pdf | 21 | Caching – (Default: Cache by Default) • If Cache by Default is selected, the UseOriginCacheControlHeaders cache policy is used. • If Do Not Cache by Default is selected, the CachingDisabled cache policy is used. • Include query string in cache – (Default: Yes, if Cache by Default is already selected) • If Do Not Cache by Default is already selected and you then choose to include the query string in the cache, the UseOriginCacheControlHeaders-QueryStrings cache policy is used. MediaPackage v1 origin Following are the origin settings that CloudFront preconfigures for your MediaPackage v1 origin in a multi-tenant distribution. Origin settings (preconfigured) • Protocol – HTTPS only • HTTPS port – 443 CloudFront multi-tenant distribution reference 44 Amazon CloudFront Developer Guide • Minimum origin SSL protocol – TLSv1.2 • Origin path – You provide this by entering your MediaPackage URL. • Add custom header – None • Enable Origin Shield – No • Connection attempts – 3 • Response timeout – 30 • Keep-alive timeout – 5 Following are the cache settings that CloudFront preconfigures for your MediaPackage v1 origin in a multi-tenant distribution. Cache settings (preconfigured) • Compress objects automatically – Yes • Viewer protocol policy – Redirect to HTTPS • Allowed HTTP method – GET, HEAD • Cache HTTP methods – No • Allow gRPC requests over HTTP/2 – No • Restrict viewer access – No • Cache policy – Elemental-MediaPackage • Origin request policy – None • Response header policy – SecurityHeadersPolicy • Smooth Streaming – No • Field level encryption – No • Enable real-time logs – No • Functions – No MediaPackage v2 origin Following are the origin settings that CloudFront preconfigures for your MediaPackage v2 origin in a multi-tenant distribution. CloudFront multi-tenant distribution reference 45 Amazon CloudFront Origin settings (preconfigured) Developer Guide • Origin Access Control – CloudFront sets this up for you and adds the policy • Protocol – HTTPS only • HTTPS port – 443 • Minimum origin SSL protocol – TLSv1.2 • Origin path – None • Add custom header – None • Enable Origin Shield – No • Connection attempts – 3 • Response timeout – 30 • Keep-alive timeout – 5 Following are the cache settings that CloudFront preconfigures for your MediaPackage v2 origin in a multi-tenant distribution. Cache settings (preconfigured) • Compress objects automatically – Yes • Viewer protocol policy – Redirect to HTTPS • Allowed HTTP method – GET, HEAD • Cache HTTP methods – No • Allow gRPC requests over HTTP/2 – No • Restrict viewer access – No • Cache policy – Elemental-MediaPackage • Origin request policy – None • Response header policy – SecurityHeadersPolicy • Smooth Streaming – No • Field level encryption – No • Enable real-time logs – No • Functions – No CloudFront multi-tenant distribution reference 46 Amazon CloudFront MediaTailor origin Developer Guide Following are the origin settings that CloudFront preconfigures for your MediaTailor origin in a multi-tenant distribution. Origin settings (preconfigured) • Protocol – HTTPS only • HTTPS port – 443 • Minimum origin SSL protocol – TLSv1.2 • Origin path – You provide this by entering your MediaPackage URL. • Add custom header – None • Enable Origin Shield – No • Connection attempts – 3 • Response timeout – 30 • Keep-alive timeout – 5 Following are the cache settings that CloudFront preconfigures for your MediaTailor origin in a multi-tenant distribution. Cache settings (preconfigured) • Compress objects automatically – Yes • Viewer protocol policy – Redirect to HTTPS • Allowed HTTP method – GET, HEAD • Cache HTTP methods – No • Allow gRPC requests over HTTP/2 – No • Restrict viewer access – No • Cache policy – None • Origin request policy – Elemental-MediaTailor-PersonalizedManifests • Response header policy – SecurityHeadersPolicy • Smooth Streaming – No • Field level encryption – No • Enable real-time logs – No CloudFront multi-tenant distribution reference 47 Amazon CloudFront • Functions – No Distribution tenant customizations Developer Guide When using a multi-tenant distribution, your distribution tenants inherit the multi-tenant distribution configuration. However, you can customize some settings at the distribution tenant level. You can customize the following: • Parameters – Parameters are key-value pairs that you can use for the origin domain or origin paths. See How parameters work with distribution tenants. • AWS WAF web ACL (V2) – You can specify a separate web ACL for the distribution tenant, which will override the web ACL used for the multi-tenant distribution. You can also disable this setting for a specific distribution tenant, which means the distribution tenant won't inherit the web ACL protections from the multi-tenant distribution. For more information, see AWS WAF web ACL. • Geographic restrictions – Geographic restrictions that you specify for a distribution tenant will override any geographic restrictions for the multi-tenant distribution. For example, if you block |
AmazonCloudFront_DevGuide-022 | AmazonCloudFront_DevGuide.pdf | 22 | or origin paths. See How parameters work with distribution tenants. • AWS WAF web ACL (V2) – You can specify a separate web ACL for the distribution tenant, which will override the web ACL used for the multi-tenant distribution. You can also disable this setting for a specific distribution tenant, which means the distribution tenant won't inherit the web ACL protections from the multi-tenant distribution. For more information, see AWS WAF web ACL. • Geographic restrictions – Geographic restrictions that you specify for a distribution tenant will override any geographic restrictions for the multi-tenant distribution. For example, if you block Germany (DE) in your multi-tenant distribution, all associated distribution tenants will also block DE. However, if you allow DE for a specific distribution tenant, that distribution tenant settings will override the settings for the multi-tenant distribution. For more information, see Restrict the geographic distribution of your content. • Invalidation paths – Specify the file paths to the content that you want to invalidate for the distribution tenant. For more information, see Invalidate files. • Custom TLS certificates – AWS Certificate Manager (ACM) certificates that you specify for distribution tenants are supplemental to the certificate provided in the multi-tenant distribution. However, if the same domain is covered by both the multi-tenant distribution and distribution tenant certificates, then the tenant certificate is used. For more information, see Request certificates for your CloudFront distribution tenant. • Domain names – Unlike standard distributions, you can specify domain names for your distribution tenants (at the tenant-level). You must specify at least one domain name per distribution tenant. Distribution tenant customizations 48 Amazon CloudFront Developer Guide How parameters work with distribution tenants A parameter is a key-value pair that you can use for placeholder values. Define the parameters that you want to use in your multi-tenant distribution and specify whether they're required. When you define parameters in your multi-tenant distribution, you choose whether those parameters are required to be entered at the distribution tenant level. • If you define the parameters as required in the multi-tenant distribution, then they must be entered at the distribution tenant level. (They are not inherited). • If the parameters are not required, then you can provide a default value in the multi-tenant distribution that is inherited by the distribution tenant. You can use parameters in the following properties: • Origin domain name • Origin path In the multi-tenant distribution, you can define up to two parameters for each of the preceding properties. Example Example You want to create multiple websites (tenants) for your customers, and you need to ensure that each distribution tenant resource uses the correct values. 1. You create a multi-tenant distribution and include two parameters for the distribution tenant configuration. 2. For the origin domain name, you create a parameter named customer-name and specify that it's required. You enter the parameter after the S3 bucket, so that it appears as https://amzn- s3-demo-bucket1.s3.region-code.amazonaws.com/{{customer-name}}. 3. For origin path, you create a second parameter named my-theme, and specify that it's optional, with a default value of basic. Your origin path appears as /{{my-theme}} 4. When you create a distribution tenant, you must specify a value for {{customer-name}} for the origin domain name because it's required. For the origin path, you can specify your own value for the {{my-theme}} parameter. If you don't, the distribution tenant will use the default value that you specified earlier. Distribution tenant customizations 49 Amazon CloudFront Developer Guide Request certificates for your CloudFront distribution tenant When you create a distribution tenant, the tenant inherits the shared AWS Certificate Manager (ACM) certificate from the multi-tenant distribution. This shared certificate provides HTTPS for all tenants associated with the multi-tenant distribution. When you create or update a CloudFront distribution tenant to add domains, you can add a managed CloudFront certificate from ACM. CloudFront then gets an HTTP-validated certificate from ACM on your behalf. You can use this tenant-level ACM certificate for custom domain configurations. CloudFront streamlines the renewal workflow to help keep certificates up-to-date and secure content delivery uninterrupted. Note You own the certificate, but it can only be used with CloudFront resources and the private key cannot be exported. You can request the certificate when you create or update the distribution tenant. Topics • Add a domain and certificate (distribution tenant) • Complete domain setup • Point domains to CloudFront • Domain considerations (distribution tenant) Add a domain and certificate (distribution tenant) The following procedure shows you how to add a domain and update the certificate for a distribution tenant. To add a domain and certificate (distribution tenant) 1. Sign in to the AWS Management Console and open the CloudFront console at https:// console.aws.amazon.com/cloudfront/v4/home. 2. Under SaaS, choose Distribution tenants. Request certificates (distribution tenant) 50 Amazon CloudFront Developer Guide 3. Search for the distribution tenant. Use the dropdown |
AmazonCloudFront_DevGuide-023 | AmazonCloudFront_DevGuide.pdf | 23 | update the distribution tenant. Topics • Add a domain and certificate (distribution tenant) • Complete domain setup • Point domains to CloudFront • Domain considerations (distribution tenant) Add a domain and certificate (distribution tenant) The following procedure shows you how to add a domain and update the certificate for a distribution tenant. To add a domain and certificate (distribution tenant) 1. Sign in to the AWS Management Console and open the CloudFront console at https:// console.aws.amazon.com/cloudfront/v4/home. 2. Under SaaS, choose Distribution tenants. Request certificates (distribution tenant) 50 Amazon CloudFront Developer Guide 3. Search for the distribution tenant. Use the dropdown menu in the search bar to filter by domain, name, distribution ID, certificate ID, connection group ID, or web ACL ID. 4. Choose the distribution tenant name. 5. 6. 7. For Domains, choose Manage domain. For Certificate, choose if you want a Custom TLS certificate for your distribution tenant. The certificate verifies whether you're authorized to use the domain name. The certificate must exist in the US East (N. Virginia) Region. For Domains, choose Add domain and enter the domain name. You can add up to 5 domains for a distribution tenant. Depending on your domain, the following messages will appear under the domain name that you enter. • This domain is covered by the certificate. • This domain is covered by the certificate, pending validation. • This domain isn't covered by a certificate. (This means you must verify domain ownership.) 8. Choose Update distribution tenant. On the tenant details page, under Domains, you can see the following fields: • Domain ownership – The status of domain ownership. Before CloudFront can serve content, your domain ownership must be verified by using TLS certificate validation. • DNS status – Your domain's DNS records must point to CloudFront to route traffic correctly. 9. If your domain ownership isn't verified, on the tenant details page, under Domains, choose Complete domain setup and then complete the following procedure to point the DNS record to your CloudFront domain name. Complete domain setup Follow these procedures to verify that you own the domain for your distribution tenants. Depending on your domain, choose one of the following procedures. Note If your domain is already pointed to CloudFront with an Amazon Route 53 alias record, you must add your DNS TXT record with _cf-challenge. in front of the domain name. This TXT record verifies that your domain name is linked to CloudFront. Repeat this step for each domain. The following shows an example TXT record: Request certificates (distribution tenant) 51 Amazon CloudFront Developer Guide • Record name: _cf-challenge.example.com • Record type: TXT • Record value: d111111abcdef8.cloudfront.net Your record will appear as: _cf-challenge.example.com TXT d111111abcdef8.cloudfront.net I have existing traffic Select this option if your domain can't tolerate downtime. You must have access to your origin/ web server. Use the following procedure to validate domain ownership. To complete domain setup when you have existing traffic 1. 2. For Specify your web traffic, choose I have existing traffic and then choose Next. For Verify domain ownership, choose one of the following options: • Use existing certificate – Search for an existing ACM certificate or enter the certificate ARN that covers the listed domains. • Manual file upload – Choose if you have direct access to upload files to your web server. For each domain, create a plain text file that contains your validation token from the Token location and upload it to your origin at the specified File path on your existing server. The path to this file might look like the following example: /.well-known/pki- validation/acm_9c2a7b2ec0524d09fa6013efb73ad123.txt. After you complete that step, ACM verifies the token and then issues the TLS certificate for the domain. • HTTP redirect – Choose if you don't have direct access to upload files to your web server, or if you're using a CDN or proxy service. For each domain, create a 301 redirect on your existing server. Copy the well-known path under Redirect from and point to the specified certificate endpoint under Redirect to. Your redirect might look like the following example: If the URL matches: example.com/.well-known/pki-validation/ leabe938a4fe077b31e1ff62b781c123.txt Then the settings are:Forwarding URL Request certificates (distribution tenant) 52 Amazon CloudFront Developer Guide Then 301 Permanent Redirect:To validation.us-east-1.acm- validations.aws/123456789012/.well-known/pki-validation/ leabe938a4fe077b31e1ff62b781c123.txt Note You can choose Check certificate status to verify when ACM issues the certificate for the domain. 3. Choose Next. 4. Complete the steps for Point domains to CloudFront. I don't have traffic Select this option if you're adding new domains. CloudFront will manage certificate validation for you. To complete domain setup if you don't have traffic 1. 2. For Specify your web traffic, choose I don't have traffic yet. For each domain name, complete the steps for Point domains to CloudFront. 3. After you update your DNS records for each domain name, choose Next. 4. Wait |
AmazonCloudFront_DevGuide-024 | AmazonCloudFront_DevGuide.pdf | 24 | validation.us-east-1.acm- validations.aws/123456789012/.well-known/pki-validation/ leabe938a4fe077b31e1ff62b781c123.txt Note You can choose Check certificate status to verify when ACM issues the certificate for the domain. 3. Choose Next. 4. Complete the steps for Point domains to CloudFront. I don't have traffic Select this option if you're adding new domains. CloudFront will manage certificate validation for you. To complete domain setup if you don't have traffic 1. 2. For Specify your web traffic, choose I don't have traffic yet. For each domain name, complete the steps for Point domains to CloudFront. 3. After you update your DNS records for each domain name, choose Next. 4. Wait for the certificate to be issued. Note You can choose Check certificate status to verify when ACM issues the certificate for the domain. 5. Choose Submit. Point domains to CloudFront Update your DNS records to route traffic from each domain to the CloudFront routing endpoint. You can have multiple domain names, but they must resolve to this endpoint. Request certificates (distribution tenant) 53 Amazon CloudFront Developer Guide To point domains to CloudFront 1. Copy the CloudFront routing endpoint value, such as d111111abcdef8.cloudfront.net. 2. Update your DNS records to route traffic from each domain to the CloudFront routing endpoint. 1. Sign in to your domain registrar or DNS provider management console. 2. Navigate to the DNS management section for your domain. • For subdomains – Create a CNAME record. For example: • Name – Your subdomain (such as www or app) • Value / Target – The CloudFront routing endpoint • Record type – CNAME • TTL – 3600 (or whatever is appropriate for your use case) • For apex/root domains – Create an ALIAS record (Route 53) or similar functionality from your DNS provider that allows apex domain redirection. For example, in Route 53: • Name – Your apex domain (such as example.com) • Record type – A • Alias – Yes • Alias target – Your CloudFront routing endpoint • Routing policy – Simple (or whatever is appropriate for your use case) 3. Verify that the DNS change has propagated. (This can take 24-48 hours.) Use a tool like dig or nslookup. dig www.example.com # Should eventually return a CNAME pointing to your CloudFront routing endpoint 3. Return to the CloudFront console and choose Submit. This returns you to the distribution tenant page. When your domain is active, CloudFront updates the domain status to indicate that your domain is ready to serve traffic. Domain considerations (distribution tenant) When a domain is active, domain control has been established and CloudFront will respond to all viewer requests to this domain. Once activated, a domain can't be deactivated or changed to an inactive status. The domain can't be associated with another CloudFront resource while it's already 54 Request certificates (distribution tenant) Amazon CloudFront Developer Guide in use. To associate the domain with another distribution, use the UpdateDomainAssociation request to move the domain from one CloudFront resource to another. When a domain is inactive, CloudFront won't respond to viewer requests to the domain. While the domain is inactive, note the following: • If you have a pending certificate request, CloudFront will respond to requests for the well-known path. While the request is pending, the domain can't be associated with any other CloudFront resources. • If you don't have a pending certificate request, CloudFront won't respond to requests for the domain. You can associate the domain with other CloudFront resources. • You can only have one pending certificate request per distribution tenant. Before you can request another certificate for additional domains, you must cancel the existing pending request. Canceling an existing certificate request does not delete the associated ACM certificate. You can delete that by using the ACM API. • If you apply a new certificate to your distribution tenant, this will disassociate the previous certificate. You can reuse the certificate to cover the domain for another distribution tenant. As with renewals for DNS-validated certificates, you will be notified when the certificate renewal succeeds. However, you don't need to do anything else. CloudFront will manage the certificate renewal for your domain automatically. Note You don't need to call the ACM API operations to create or update your certificate resources. You can manage your certificates by using the CreateDistributionTenant and UpdateDistributionTenant API operations to specify the details for your managed certificate request. Create custom connection group (optional) By default, CloudFront creates a connection group for you when you create a multi-tenant distribution. The connection group controls how viewer requests for content connect to CloudFront. We recommend that you use the default connection group. However, if you need to isolate enterprise applications or manage groups of distribution tenants separately, you can choose to Create custom connection group (optional) 55 Amazon CloudFront Developer Guide create a custom connection group. For example, you might need to move a |
AmazonCloudFront_DevGuide-025 | AmazonCloudFront_DevGuide.pdf | 25 | by using the CreateDistributionTenant and UpdateDistributionTenant API operations to specify the details for your managed certificate request. Create custom connection group (optional) By default, CloudFront creates a connection group for you when you create a multi-tenant distribution. The connection group controls how viewer requests for content connect to CloudFront. We recommend that you use the default connection group. However, if you need to isolate enterprise applications or manage groups of distribution tenants separately, you can choose to Create custom connection group (optional) 55 Amazon CloudFront Developer Guide create a custom connection group. For example, you might need to move a distribution tenant to a separate connection group if it experiences a DDoS attack. This way, you can protect other distribution tenants from impact. Create custom connection group (optional) Optionally, you can choose to create a custom connection group for your distribution tenants. To create a custom connection group (optional) 1. Sign in to the AWS Management Console and open the CloudFront console at https:// 2. 3. 4. 5. 6. 7. console.aws.amazon.com/cloudfront/v4/home. In the navigation pane, choose Settings. Turn on the Connection group settings. In the navigation pane, choose Connection groups, and then choose Create connection group. For Connection group name, enter a name for the connection group. You can't update this name after you create the connection group. For IPv6, specify if you want to enable this IP protocol. For more information, see Enable IPv6. For Anycast static IP list, specify if you want to deliver traffic to your distribution tenants from a set of IP addresses. For more information, see Anycast static IP list. 8. (Optional) Add tags to your connection group. 9. Choose Create connection group. When your connection group is created, you can find the settings that you specified, and also the ARN and endpoint. • The ARN looks like the following example: arn:aws:cloudfront::123456789012:connection-group/ cg_2uVbA9KeWaADTbKzhj9lcKDoM25 • The endpoint looks like the following example: d111111abcdef8.cloudfront.net You can edit or delete your custom connection group after you create it. Before you can delete a connection group, you must first delete all associated distribution tenants from it. You can't delete the default connection group that CloudFront created for you when you created your multi-tenant distribution. Create custom connection group (optional) 56 Amazon CloudFront Important Developer Guide If you change the connection group for a distribution tenant, CloudFront will continue to carry traffic for the distribution tenant, but with increased latency. We recommend that you update the DNS record for the distribution tenant to use the CloudFront routing endpoint from the new connection group. Until you update the DNS record, CloudFront will route based on settings defined for the routing endpoint that the website is currently pointing to with DNS. For example, assume that your default connection group does not use Anycast static IPs but your new, custom connection group does. You must update the DNS record before CloudFront will use Anycast static IPs for the distribution tenants in your custom connection group. Create a distribution This topic explains how to use the CloudFront console to create a distribution. Overview 1. Create one or more Amazon S3 buckets, or configure HTTP servers as your origin servers. An origin is the location where you store the original version of your content. When CloudFront gets a request for your files, it goes to the origin to get the files that it distributes at edge locations. You can use any combination of Amazon S3 buckets and HTTP servers as your origin servers. • If you use Amazon S3, the name of your bucket must be all lowercase and cannot contain spaces. • If you use an Amazon EC2 server or another custom origin, review Use Amazon EC2 (or another custom origin). • For the current maximum number of origins that you can create for a distribution, or to request a higher quota, see General quotas on distributions. 2. Upload your content to your origin servers. You make your objects publicly readable, or you can use CloudFront signed URLs to restrict access to your content. Create a distribution 57 Amazon CloudFront Developer Guide Important You are responsible for ensuring the security of your origin server. You must ensure that CloudFront has permission to access the server and that the security settings safeguard your content. 3. Create your CloudFront distribution: • For a detailed procedure that creates a distribution in the CloudFront console, see Create a CloudFront distribution in the console. • For information about creating a distribution using the CloudFront API, see CreateDistribution in the Amazon CloudFront API Reference. 4. (Optional) If you use the CloudFront console to create your distribution, create more cache behaviors or origins for the distribution. For more information about behaviors and origins, see To update a multi-tenant distribution. 5. Test your distribution. For more information about testing, see Test a |
AmazonCloudFront_DevGuide-026 | AmazonCloudFront_DevGuide.pdf | 26 | server and that the security settings safeguard your content. 3. Create your CloudFront distribution: • For a detailed procedure that creates a distribution in the CloudFront console, see Create a CloudFront distribution in the console. • For information about creating a distribution using the CloudFront API, see CreateDistribution in the Amazon CloudFront API Reference. 4. (Optional) If you use the CloudFront console to create your distribution, create more cache behaviors or origins for the distribution. For more information about behaviors and origins, see To update a multi-tenant distribution. 5. Test your distribution. For more information about testing, see Test a distribution. 6. Develop your website or application to access your content using the domain name that CloudFront returned after you created your distribution in Step 3. For example, if CloudFront returns d111111abcdef8.cloudfront.net as the domain name for your distribution, the URL for the file image.jpg in an Amazon S3 bucket or in the root directory on an HTTP server is https://d111111abcdef8.cloudfront.net/image.jpg. If you specified one or more alternate domain names (CNAMEs) when you created your distribution, you can use your own domain name. In that case, the URL for image.jpg might be https://www.example.com/image.jpg. Note the following: • If you want to use signed URLs to restrict access to your content, see Serve private content with signed URLs and signed cookies. • If you want to serve compressed content, see Serve compressed files. • For information about CloudFront request and response behavior for Amazon S3 and custom origins, see Request and response behavior. Topics Create a distribution 58 Amazon CloudFront Developer Guide • Create a CloudFront distribution in the console • Values that CloudFront displays in the console • Additional links Create a CloudFront distribution in the console You can create CloudFront multi-tenant distributions with settings that can be reused across multiple distribution tenants. With a multi-tenant distribution, you can have CloudFront configure your distribution settings for you, based on your content origin type. For more details about the preconfigured settings, see CloudFront multi-tenant distribution reference. You can also create distributions with settings that can be reused across multiple distribution tenants. For more information, see Understand how multi-tenant distributions work. Alternatively, you can use a standard distribution and manually configure your own distribution settings. Multi-tenant To create a multi-tenant distribution 1. Sign in to the AWS Management Console and open the CloudFront console at https:// console.aws.amazon.com/cloudfront/v4/home. 2. In the navigation pane, choose Distributions, then choose Create distribution. 3. Choose Multi-tenant architecture, Next. 4. Enter a Distribution name for the multi-tenant distribution. The name will appear as the value for the Name key. You can change this value later. You can add up to 50 tags for your multi-tenant distribution. For more information, see Tag a distribution . 5. (Optional) For Wildcard certificate, choose the AWS Certificate Manager (ACM) certificate that will cover all subdomains under the root domain, such as *.example.com. The certificate must be in the US East (N. Virginia) Region. 6. Choose Next. 7. On the Specify origin page, select the origin type that CloudFront will get your content from. CloudFront will use the recommended settings for that origin type for your multi- tenant distribution. For more information about the recommended settings, see CloudFront multi-tenant distribution reference. 8. 9. For Origin, under the origin type that you selected, choose or enter the origin to use. For Origin path, enter the forward slash (/) character, followed by the origin path. Create a CloudFront distribution in the console 59 Amazon CloudFront Developer Guide 10. (Optional) To add a parameter, choose Insert parameter for either the origin domain name or origin path. You can enter up to two parameters for each field. a. Choose Create new parameter. b. On the Create new parameter dialog box, for Parameter name, enter a unique name for the parameter and, optionally, a description. c. For Required parameter, select the checkbox to make this parameter value required at the distribution tenant level. If it's not required, enter a Default value that the distribution tenant will inherit. d. Choose Create parameter. This parameter appears in the corresponding field. 11. For Options, choose one of the following options: • Use recommended origin settings – Use the default recommended cache and origin settings for the origin type that you selected. • Customize origin settings – Customize the cache and origin settings. If you choose this option, specify your own values that appear. 12. Choose Next. 13. On the Enable security protections page, choose whether to enable AWS WAF security protections. You can customize the web ACL for specific distribution tenants later. For more information, see Enable AWS WAF for a new distribution. 14. Choose Next, Create distribution. 15. On the Distributions page, your multi-tenant distribution appears in the list of resources. You can choose the All distributions dropdown to filter |
AmazonCloudFront_DevGuide-027 | AmazonCloudFront_DevGuide.pdf | 27 | and origin settings for the origin type that you selected. • Customize origin settings – Customize the cache and origin settings. If you choose this option, specify your own values that appear. 12. Choose Next. 13. On the Enable security protections page, choose whether to enable AWS WAF security protections. You can customize the web ACL for specific distribution tenants later. For more information, see Enable AWS WAF for a new distribution. 14. Choose Next, Create distribution. 15. On the Distributions page, your multi-tenant distribution appears in the list of resources. You can choose the All distributions dropdown to filter by standard distribution or multi- tenant distribution. You can also choose the Type column to filter by standard or multi- tenant distribution. By default, CloudFront creates a connection group for you. The connection group controls how viewer requests for content connect to CloudFront. You can customize some routing settings in the connection group. For more information, see Understand how multi-tenant distributions work. You can create additional distribution tenants using the multi-tenant distribution as a template. Create a CloudFront distribution in the console 60 Amazon CloudFront Developer Guide To create a distribution tenant 1. Sign in to the AWS Management Console and open the CloudFront console at https:// console.aws.amazon.com/cloudfront/v4/home. 2. In the navigation pane, do one of the following: • • Choose Distributions, choose a multi-tenant distribution, and then choose Create tenant. Choose Distribution tenants and then choose Create tenant. 3. 4. 5. For Distribution tenant name, enter the name. The name must be unique in your AWS account and can't be changed after you create it. For Template distribution, choose a multi-tenant distribution ID from the list. For Manage tags, add up to 50 key-value pairs for the distribution tenant. For more information, see Tag a distribution. 6. Choose Next. 7. On the Add domains page, for Certificate, choose if you want a Custom TLS certificate for your distribution tenant. The certificate verifies whether you're authorized to use the domain name. The certificate must exist in the US East (N. Virginia) Region. 8. For Domains, enter your domain name. You can add up to 5 domains per distribution tenant. Note If you entered a domain name that isn't covered by a certificate, you will need to verify that you own the domain. You can still create the distribution tenant for now and verify domain ownership later. For more information, see Request certificates for your CloudFront distribution tenant. 9. Choose Next. 10. On the Define parameters page, the parameters that you specified in the multi-tenant distribution appear. For required parameters, enter a value next to the parameter name and save your changes. 11. To add another parameter, choose Add parameter and enter a name and value. 12. Choose Next. 13. (Optional) For Security customization, if you choose to Override distribution settings, select the option for your use case. Create a CloudFront distribution in the console 61 Amazon CloudFront Developer Guide 14. (Optional) For Geographic restrictions customization, if you choose to Override distribution settings, select the appropriate Restriction type and Countries for the distribution tenant. For more information, see Restrict the geographic distribution of your content. 15. Choose Next. 16. Choose Create distribution tenant. You can find all your distribution tenants on the Distribution tenants page. You can filter by the following: Association • Distribution ID • Certificate ID • Connection group ID • Web ACL ID Properties • Name • Domain You can edit your distribution tenants to customize specific settings. For more information, see Distribution tenant customizations. Standard To create a standard distribution 1. Sign in to the AWS Management Console and open the CloudFront console at https:// console.aws.amazon.com/cloudfront/v4/home. 2. 3. In the navigation pane, choose Distributions, then choose Create distribution. Specify settings for the distribution. For more information, see Distribution settings reference. 4. Save your changes. Create a CloudFront distribution in the console 62 Amazon CloudFront Developer Guide 5. After CloudFront creates your distribution, the value of the Status column for your distribution will change from Deploying to the date and time that the distribution is deployed. If you chose to enable the distribution, it will be ready to process requests at this time. The domain name that CloudFront assigns to your distribution appears in the list of distributions. (It also appears on the General tab for a selected distribution.) Tip You can use an alternate domain name, instead of the name assigned to you by CloudFront; by following the steps in Use custom URLs by adding alternate domain names (CNAMEs). 6. When your distribution is deployed, confirm that you can access your content by using your new CloudFront URL (d111111abcdef8.cloudfront.net) or the CNAME. For more information, see Test a distribution. Values that CloudFront displays in the console When you create a new distribution or update an existing distribution, |
AmazonCloudFront_DevGuide-028 | AmazonCloudFront_DevGuide.pdf | 28 | assigns to your distribution appears in the list of distributions. (It also appears on the General tab for a selected distribution.) Tip You can use an alternate domain name, instead of the name assigned to you by CloudFront; by following the steps in Use custom URLs by adding alternate domain names (CNAMEs). 6. When your distribution is deployed, confirm that you can access your content by using your new CloudFront URL (d111111abcdef8.cloudfront.net) or the CNAME. For more information, see Test a distribution. Values that CloudFront displays in the console When you create a new distribution or update an existing distribution, CloudFront displays the following information in the CloudFront console. Note Active trusted signers, the AWS accounts that have an active CloudFront key pair and can be used to create valid signed URLs, are currently not visible in the CloudFront console. Distribution ID When you perform an action on a distribution using the CloudFront API, you use the distribution ID to specify which distribution to use, for example, EDFDVBD6EXAMPLE. You can't change a distribution's distribution ID. Values that are displayed 63 Amazon CloudFront Deploying and status Developer Guide When you deploy a distribution, you see the Deploying status under the Last modified column. Wait for the distribution to finish deploying and make sure the Status column shows Enabled. For more information, see Distribution state. Last modified The date and time that the distribution was last modified, using ISO 8601 format, for example, 2012-05-19T19:37:58Z. For more information, see https://www.w3.org/TR/NOTE-datetime. Domain name You use the distribution's domain name in the links to your objects. For example, if your distribution's domain name is d111111abcdef8.cloudfront.net, the link to /images/ image.jpg would be https://d111111abcdef8.cloudfront.net/images/image.jpg. You can't change the CloudFront domain name for your distribution. For more information about CloudFront URLs for links to your objects, see Customize the URL format for files in CloudFront. If you specified one or more alternate domain names (CNAMEs), you can use your own domain names for links to your objects instead of using the CloudFront domain name. For more information about CNAMEs, see Alternate domain names (CNAMEs). Note CloudFront domain names are unique. Your distribution's domain name was never used for a previous distribution and will never be reused for another distribution in the future. Additional links For more information about creating a distribution, see the following links. • To learn how to create a distribution that uses an Amazon Simple Storage Service (Amazon S3) bucket origin with origin access control (OAC), see Get started with a basic CloudFront distribution. • For information about using the CloudFront APIs to create a distribution, see CreateDistribution in the Amazon CloudFront API Reference. Additional links 64 Amazon CloudFront Developer Guide • For information about updating a distribution (for example, to add cache behaviors to standard distributions, or to customize distribution tenants), see Update a distribution. • To see the current maximum number of distributions that you can create for each AWS account, or to request a higher quota (formerly known as limit), see General quotas on distributions. Distribution settings reference When you use the CloudFront console to create a new standard distribution or update an existing standard distribution, you specify the following values. When you create a multi-tenant distribution, CloudFront configures your distribution settings for you, based on your content origin type. For more details about the preconfigured settings, see CloudFront multi-tenant distribution reference. For more information about creating or updating a distribution by using the CloudFront console, see the section called “Create a distribution” or the section called “Update a distribution”. Topics • Origin settings • Cache behavior settings • Distribution settings • Custom error pages and error caching • Geographic restrictions Origin settings When you use the CloudFront console to create or update a distribution, you provide information about one or more locations, known as origins, where you store the original versions of your web content. CloudFront gets your web content from your origins and serves it to viewers via a worldwide network of edge servers. For the current maximum number of origins that you can create for a distribution, or to request a higher quota, see the section called “General quotas on distributions”. If you want to delete an origin, you must first edit or delete the cache behaviors that are associated with that origin. Distribution settings 65 Amazon CloudFront Important Developer Guide If you delete an origin, confirm that files that were previously served by that origin are available in another origin and that your cache behaviors are now routing requests for those files to the new origin. When you create or update a distribution, you specify the following values for each origin. Topics • Origin domain • Protocol (custom origins only) • Origin path • Name • Origin access (Amazon S3 origins only) • Add custom header • |
AmazonCloudFront_DevGuide-029 | AmazonCloudFront_DevGuide.pdf | 29 | you must first edit or delete the cache behaviors that are associated with that origin. Distribution settings 65 Amazon CloudFront Important Developer Guide If you delete an origin, confirm that files that were previously served by that origin are available in another origin and that your cache behaviors are now routing requests for those files to the new origin. When you create or update a distribution, you specify the following values for each origin. Topics • Origin domain • Protocol (custom origins only) • Origin path • Name • Origin access (Amazon S3 origins only) • Add custom header • Enable Origin Shield • Connection attempts • Connection timeout • Response timeout (custom and VPC origins only) • Keep-alive timeout (custom and VPC origins only) • Response and keep-alive timeout quotas Origin domain The origin domain is the DNS domain name of the resource where CloudFront will get objects for your origin, such as an Amazon S3 bucket or HTTP server. For example: • Amazon S3 bucket – amzn-s3-demo-bucket.s3.us-west-2.amazonaws.com Note If you recently created the S3 bucket, the CloudFront distribution might return HTTP 307 Temporary Redirect responses for up to 24 hours. It can take up to 24 hours for the S3 bucket name to propagate to all AWS Regions. When the propagation is complete, Origin settings 66 Amazon CloudFront Developer Guide the distribution automatically stops sending these redirect responses; you don't need to take any action. For more information, see Why am I getting an HTTP 307 Temporary Redirect response from Amazon S3? and Temporary Request Redirection. • Amazon S3 bucket configured as a website – amzn-s3-demo-bucket.s3-website.us- west-2.amazonaws.com • MediaStore container – examplemediastore.data.mediastore.us- west-1.amazonaws.com • MediaPackage endpoint – examplemediapackage.mediapackage.us- west-1.amazonaws.com • Amazon EC2 instance – ec2-203-0-113-25.compute-1.amazonaws.com • Elastic Load Balancing load balancer – example-load-balancer-1234567890.us- west-2.elb.amazonaws.com • Your own web server – www.example.com Choose the domain name in the Origin domain field, or type the name. Resources from opt-in Regions must be entered manually. The domain name is not case-sensitive. Your origin domain must have a publicly resolvable DNS name that routes requests from clients to targets over the internet. If you configure CloudFront to connect to your origin over HTTPS, one of the domain names in the certificate must match the domain name that you specify for Origin Domain Name. If no domain name matches, CloudFront returns HTTP status code 502 (Bad Gateway) to the viewer. For more information, see Domain names in the CloudFront distribution and in the certificate and SSL/TLS negotiation failure between CloudFront and a custom origin server. Note If you are using an origin request policy that forwards the viewer host header to the origin, the origin must respond with a certificate that matches the viewer host header. For more information, see Add CloudFront request headers. If your origin is an Amazon S3 bucket, note the following: Origin settings 67 Amazon CloudFront Developer Guide • If the bucket is configured as a website, enter the Amazon S3 static website hosting endpoint for your bucket; don’t select the bucket name from the list in the Origin domain field. The static website hosting endpoint appears in the Amazon S3 console, on the Properties page under Static website hosting. For more information, see the section called “Use an Amazon S3 bucket that's configured as a website endpoint”. • If you configured Amazon S3 Transfer Acceleration for your bucket, do not specify the s3- accelerate endpoint for Origin domain. • If you're using a bucket from a different AWS account and if the bucket is not configured as a website, enter the name, using the following format: bucket-name.s3.region.amazonaws.com If your bucket reside in a US Region, and you want Amazon S3 to route requests to a facility in northern Virginia, use the following format: bucket-name.s3.us-east-1.amazonaws.com • The files must be publicly readable unless you secure your content in Amazon S3 by using a CloudFront origin access control. For more information about access control, see the section called “Restrict access to an Amazon S3 origin”. Important If the origin is an Amazon S3 bucket, the bucket name must conform to DNS naming requirements. For more information, go to Bucket restrictions and limitations in the Amazon Simple Storage Service User Guide. When you change the value of Origin domain for an origin, CloudFront immediately begins replicating the change to CloudFront edge locations. Until the distribution configuration is updated in a given edge location, CloudFront continues to forward requests to the previous origin. As soon as the distribution configuration is updated in that edge location, CloudFront begins to forward requests to the new origin. Changing the origin does not require CloudFront to repopulate edge caches with objects from the new origin. As long as the viewer requests in your application have not changed, CloudFront continues to serve objects that are already in |
AmazonCloudFront_DevGuide-030 | AmazonCloudFront_DevGuide.pdf | 30 | When you change the value of Origin domain for an origin, CloudFront immediately begins replicating the change to CloudFront edge locations. Until the distribution configuration is updated in a given edge location, CloudFront continues to forward requests to the previous origin. As soon as the distribution configuration is updated in that edge location, CloudFront begins to forward requests to the new origin. Changing the origin does not require CloudFront to repopulate edge caches with objects from the new origin. As long as the viewer requests in your application have not changed, CloudFront continues to serve objects that are already in an edge cache until the TTL on each object expires or until seldom-requested objects are evicted. Origin settings 68 Amazon CloudFront Developer Guide Protocol (custom origins only) Note This applies only to custom origins. The protocol policy that you want CloudFront to use when fetching objects from your origin. Choose one of the following values: • HTTP only: CloudFront uses only HTTP to access the origin. Important HTTP only is the default setting when the origin is an Amazon S3 static website hosting endpoint, because Amazon S3 doesn’t support HTTPS connections for static website hosting endpoints. The CloudFront console does not support changing this setting for Amazon S3 static website hosting endpoints. • HTTPS only: CloudFront uses only HTTPS to access the origin. • Match viewer: CloudFront communicates with your origin using HTTP or HTTPS, depending on the protocol of the viewer request. CloudFront caches the object only once even if viewers make requests using both HTTP and HTTPS protocols. Important For HTTPS viewer requests that CloudFront forwards to this origin, one of the domain names in the SSL/TLS certificate on your origin server must match the domain name that you specify for Origin domain. Otherwise, CloudFront responds to the viewer requests with an HTTP status code 502 (Bad Gateway) instead of returning the requested object. For more information, see the section called “Requirements for using SSL/TLS certificates with CloudFront”. Topics • HTTP port • HTTPS port Origin settings 69 Amazon CloudFront • Minimum origin SSL protocol HTTP port Note This applies only to custom origins. Developer Guide (Optional) You can specify the HTTP port on which the custom origin listens. Valid values include ports 80, 443, and 1024 to 65535. The default value is port 80. Important Port 80 is the default setting when the origin is an Amazon S3 static website hosting endpoint, because Amazon S3 only supports port 80 for static website hosting endpoints. The CloudFront console does not support changing this setting for Amazon S3 static website hosting endpoints. HTTPS port Note This applies only to custom origins. (Optional) You can specify the HTTPS port on which the custom origin listens. Valid values include ports 80, 443, and 1024 to 65535. The default value is port 443. When Protocol is set to HTTP only, you cannot specify a value for HTTPS port. Minimum origin SSL protocol Note This applies only to custom origins. Origin settings 70 Amazon CloudFront Developer Guide Choose the minimum TLS/SSL protocol that CloudFront can use when it establishes an HTTPS connection to your origin. Lower TLS protocols are less secure, so we recommend that you choose the latest TLS protocol that your origin supports. When Protocol is set to HTTP only, you cannot specify a value for Minimum origin SSL protocol. If you use the CloudFront API to set the TLS/SSL protocol for CloudFront to use, you cannot set a minimum protocol. Instead, you specify all of the TLS/SSL protocols that CloudFront can use with your origin. For more information, see OriginSslProtocols in the Amazon CloudFront API Reference. Origin path If you want CloudFront to request your content from a directory in your origin, enter the directory path, beginning with a slash (/). CloudFront appends the directory path to the value of Origin domain, for example, cf-origin.example.com/production/images. Do not add a slash (/) at the end of the path. For example, suppose you’ve specified the following values for your distribution: • Origin domain – An Amazon S3 bucket named amzn-s3-demo-bucket • Origin path – /production • Alternate domain names (CNAME) – example.com When a user enters example.com/index.html in a browser, CloudFront sends a request to Amazon S3 for amzn-s3-demo-bucket/production/index.html. When a user enters example.com/acme/index.html in a browser, CloudFront sends a request to Amazon S3 for amzn-s3-demo-bucket/production/acme/index.html. Name A name is a string that uniquely identifies this origin in this distribution. If you create cache behaviors in addition to the default cache behavior, you use the name that you specify here to identify the origin that you want CloudFront to route a request to when the request matches the path pattern for that cache behavior. Origin settings 71 Amazon CloudFront Developer Guide Origin access (Amazon S3 origins only) Note This applies only to |
AmazonCloudFront_DevGuide-031 | AmazonCloudFront_DevGuide.pdf | 31 | a request to Amazon S3 for amzn-s3-demo-bucket/production/index.html. When a user enters example.com/acme/index.html in a browser, CloudFront sends a request to Amazon S3 for amzn-s3-demo-bucket/production/acme/index.html. Name A name is a string that uniquely identifies this origin in this distribution. If you create cache behaviors in addition to the default cache behavior, you use the name that you specify here to identify the origin that you want CloudFront to route a request to when the request matches the path pattern for that cache behavior. Origin settings 71 Amazon CloudFront Developer Guide Origin access (Amazon S3 origins only) Note This applies only to Amazon S3 bucket origins (those that are not using the S3 static website endpoint). Choose Origin access control settings (recommended) if you want to make it possible to restrict access to an Amazon S3 bucket origin to only specific CloudFront distributions. Choose Public if the Amazon S3 bucket origin is publicly accessible. For more information, see the section called “Restrict access to an Amazon S3 origin”. For information about how to require users to access objects on a custom origin by using only CloudFront URLs, see the section called “Restrict access to files on custom origins”. Add custom header If you want CloudFront to add custom headers whenever it sends a request to your origin, specify the header name and its value. For more information, see the section called “Add custom headers to origin requests”. For the current maximum number of custom headers that you can add, the maximum length of a custom header name and value, and the maximum total length of all header names and values, see Quotas. Enable Origin Shield Choose Yes to enable CloudFront Origin Shield. For more information about Origin Shield, see the section called “Using Origin Shield”. Connection attempts You can set the number of times that CloudFront attempts to connect to the origin. You can specify 1, 2, or 3 as the number of attempts. The default number (if you don’t specify otherwise) is 3. Use this setting together with Connection timeout to specify how long CloudFront waits before attempting to connect to the secondary origin or returning an error response to the viewer. By default, CloudFront waits as long as 30 seconds (3 attempts of 10 seconds each) before attempting Origin settings 72 Amazon CloudFront Developer Guide to connect to the secondary origin or returning an error response. You can reduce this time by specifying fewer attempts, a shorter connection timeout, or both. If the specified number of connection attempts fail, CloudFront does one of the following: • If the origin is part of an origin group, CloudFront attempts to connect to the secondary origin. If the specified number of connection attempts to the secondary origin fail, then CloudFront returns an error response to the viewer. • If the origin is not part of an origin group, CloudFront returns an error response to the viewer. For a custom origin (including an Amazon S3 bucket that’s configured with static website hosting), this setting also specifies the number of times that CloudFront attempts to get a response from the origin. For more information, see the section called “Response timeout (custom and VPC origins only)”. Connection timeout The connection timeout is the number of seconds that CloudFront waits when trying to establish a connection to the origin. You can specify a number of seconds between 1 and 10 (inclusive). The default timeout (if you don’t specify otherwise) is 10 seconds. Use this setting together with Connection attempts to specify how long CloudFront waits before attempting to connect to the secondary origin or before returning an error response to the viewer. By default, CloudFront waits as long as 30 seconds (3 attempts of 10 seconds each) before attempting to connect to the secondary origin or returning an error response. You can reduce this time by specifying fewer attempts, a shorter connection timeout, or both. If CloudFront doesn’t establish a connection to the origin within the specified number of seconds, CloudFront does one of the following: • If the specified number of Connection attempts is more than 1, CloudFront tries again to establish a connection. CloudFront tries up to 3 times, as determined by the value of Connection attempts. • If all the connection attempts fail and the origin is part of an origin group, CloudFront attempts to connect to the secondary origin. If the specified number of connection attempts to the secondary origin fail, then CloudFront returns an error response to the viewer. • If all the connection attempts fail and the origin is not part of an origin group, CloudFront returns an error response to the viewer. Origin settings 73 Amazon CloudFront Developer Guide Response timeout (custom and VPC origins only) The origin response timeout, also known as the origin read timeout or origin request |
AmazonCloudFront_DevGuide-032 | AmazonCloudFront_DevGuide.pdf | 32 | Connection attempts. • If all the connection attempts fail and the origin is part of an origin group, CloudFront attempts to connect to the secondary origin. If the specified number of connection attempts to the secondary origin fail, then CloudFront returns an error response to the viewer. • If all the connection attempts fail and the origin is not part of an origin group, CloudFront returns an error response to the viewer. Origin settings 73 Amazon CloudFront Developer Guide Response timeout (custom and VPC origins only) The origin response timeout, also known as the origin read timeout or origin request timeout, applies to both of the following values: • How long (in seconds) CloudFront waits for a response after forwarding a request to the origin. • How long (in seconds) CloudFront waits after receiving a packet of a response from the origin and before receiving the next packet. Tip If you want to increase the timeout value because viewers are experiencing HTTP 504 status code errors, consider exploring other ways to eliminate those errors before changing the timeout value. See the troubleshooting suggestions in the section called “HTTP 504 status code (Gateway Timeout)”. CloudFront behavior depends on the HTTP method in the viewer request: • GET and HEAD requests – If the origin doesn’t respond or stops responding within the duration of the response timeout, CloudFront drops the connection. CloudFront tries again to connect according to the value of the section called “Connection attempts”. • DELETE, OPTIONS, PATCH, PUT, and POST requests – If the origin doesn’t respond for the duration of the read timeout, CloudFront drops the connection and doesn’t try again to contact the origin. The client can resubmit the request if necessary. Keep-alive timeout (custom and VPC origins only) The keep-alive timeout is how long (in seconds) CloudFront tries to maintain a connection to your custom origin after it gets the last packet of a response. Maintaining a persistent connection saves the time that is required to re-establish the TCP connection and perform another TLS handshake for subsequent requests. Increasing the keep-alive timeout helps improve the request- per-connection metric for distributions. Origin settings 74 Amazon CloudFront Note Developer Guide For the Keep-alive timeout value to have an effect, your origin must be configured to allow persistent connections. Response and keep-alive timeout quotas Note This applies only to custom origins. • For response timeout, the default is 30 seconds. • For keep-alive timeout, the default is 5 seconds. • For either quota, you can specify a value from 1 to 60 seconds. To request an increase, create a case in the AWS Support Center Console/. After you request a timeout increase for your AWS account, update your distribution origins so that they have the response timeout and keep-alive timeout values that you want. A quota increase for your account doesn't automatically update your origins. For example, if you're using a Lambda@Edge function to set a keep-alive timeout of 90 seconds, your origin must already have a keep-alive timeout of 90 seconds or more. Otherwise, your Lambda@Edge function might fail to execute. For more information about distribution quotas, see General quotas on distributions. Cache behavior settings By setting the cache behavior, you can configure a variety of CloudFront functionality for a given URL path pattern for files on your website. For example, one cache behavior might apply to all .jpg files in the images directory on a web server that you're using as an origin server for CloudFront. The functionality that you can configure for each cache behavior includes: • The path pattern • If you have configured multiple origins for your CloudFront distribution, the origin to which you want CloudFront to forward your requests Cache behavior settings 75 Amazon CloudFront Developer Guide • Whether to forward query strings to your origin • Whether accessing the specified files requires signed URLs • Whether to require users to use HTTPS to access those files • The minimum amount of time that those files stay in the CloudFront cache regardless of the value of any Cache-Control headers that your origin adds to the files When you create a new distribution, you specify settings for the default cache behavior, which automatically forwards all requests to the origin that you specify when you create the distribution. After you create a distribution, you can create additional cache behaviors that define how CloudFront responds when it receives a request for objects that match a path pattern, for example, *.jpg. If you create additional cache behaviors, the default cache behavior is always the last to be processed. Other cache behaviors are processed in the order in which they're listed in the CloudFront console or, if you're using the CloudFront API, the order in which they're listed in the DistributionConfig element for the distribution. For more information, |
AmazonCloudFront_DevGuide-033 | AmazonCloudFront_DevGuide.pdf | 33 | all requests to the origin that you specify when you create the distribution. After you create a distribution, you can create additional cache behaviors that define how CloudFront responds when it receives a request for objects that match a path pattern, for example, *.jpg. If you create additional cache behaviors, the default cache behavior is always the last to be processed. Other cache behaviors are processed in the order in which they're listed in the CloudFront console or, if you're using the CloudFront API, the order in which they're listed in the DistributionConfig element for the distribution. For more information, see Path pattern. When you create a cache behavior, you specify the one origin from which you want CloudFront to get objects. As a result, if you want CloudFront to distribute objects from all of your origins, you must have at least as many cache behaviors (including the default cache behavior) as you have origins. For example, if you have two origins and only the default cache behavior, the default cache behavior causes CloudFront to get objects from one of the origins, but the other origin is never used. For the current maximum number of cache behaviors that you can add to a distribution, or to request a higher quota (formerly known as limit), see General quotas on distributions. Topics • Path pattern • Origin or origin group • Viewer protocol policy • Allowed HTTP methods • Field-level encryption config • Cached HTTP methods • Allow gRPC requests over HTTP/2 • Cache based on selected request headers • Allowlist headers Cache behavior settings 76 Developer Guide Amazon CloudFront • Object caching • Minimum TTL • Maximum TTL • Default TTL • Forward cookies • Allowlist cookies • Query string forwarding and caching • Query string allowlist • Smooth Streaming • Restrict viewer access (use signed URLs or signed cookies) • Trusted signers • AWS account numbers • Compress objects automatically • CloudFront event • Lambda function ARN • Include body Path pattern A path pattern (for example, images/*.jpg) specifies to which requests you want this cache behavior to apply. When CloudFront receives an end-user request, the requested path is compared with path patterns in the order in which cache behaviors are listed in the distribution. The first match determines which cache behavior is applied to that request. For example, suppose you have three cache behaviors with the following three path patterns, in this order: • images/*.jpg • images/* • *.gif Note You can optionally include a slash (/) at the beginning of the path pattern, for example, /images/*.jpg. CloudFront behavior is the same with or without the leading /. If you Cache behavior settings 77 Amazon CloudFront Developer Guide don't specify the / at the beginning of the path, this character is automatically implied; CloudFront treats the path the same with or without the leading /. For example, CloudFront treats /*product.jpg the same as *product.jpg A request for the file images/sample.gif doesn't satisfy the first path pattern, so the associated cache behaviors are not applied to the request. The file does satisfy the second path pattern, so the cache behaviors associated with the second path pattern are applied even though the request also matches the third path pattern. Note When you create a new distribution, the value of Path Pattern for the default cache behavior is set to * (all files) and cannot be changed. This value causes CloudFront to forward all requests for your objects to the origin that you specified in the Origin domain field. If the request for an object does not match the path pattern for any of the other cache behaviors, CloudFront applies the behavior that you specify in the default cache behavior. Important Define path patterns and their sequence carefully or you may give users undesired access to your content. For example, suppose a request matches the path pattern for two cache behaviors. The first cache behavior does not require signed URLs and the second cache behavior does require signed URLs. Users are able to access the objects without using a signed URL because CloudFront processes the cache behavior associated with the first match. If you're working with a MediaPackage channel, you must include specific path patterns for the cache behavior that you define for the endpoint type for your origin. For example, for a DASH endpoint, you type *.mpd for Path Pattern. For more information and specific instructions, see Serve live video formatted with AWS Elemental MediaPackage. The path you specify applies to requests for all files in the specified directory and in subdirectories below the specified directory. CloudFront does not consider query strings or cookies when Cache behavior settings 78 Amazon CloudFront Developer Guide evaluating the path pattern. For example, if an images directory contains product1 and product2 subdirectories, the path pattern |
AmazonCloudFront_DevGuide-034 | AmazonCloudFront_DevGuide.pdf | 34 | specific path patterns for the cache behavior that you define for the endpoint type for your origin. For example, for a DASH endpoint, you type *.mpd for Path Pattern. For more information and specific instructions, see Serve live video formatted with AWS Elemental MediaPackage. The path you specify applies to requests for all files in the specified directory and in subdirectories below the specified directory. CloudFront does not consider query strings or cookies when Cache behavior settings 78 Amazon CloudFront Developer Guide evaluating the path pattern. For example, if an images directory contains product1 and product2 subdirectories, the path pattern images/*.jpg applies to requests for any .jpg file in the images, images/product1, and images/product2 directories. If you want to apply a different cache behavior to the files in the images/product1 directory than the files in the images and images/product2 directories, create a separate cache behavior for images/ product1 and move that cache behavior to a position above (before) the cache behavior for the images directory. You can use the following wildcard characters in your path pattern: • * matches 0 or more characters. • ? matches exactly 1 character. The following examples show how the wildcard characters work: Path pattern Files that match the path pattern *.jpg All .jpg files. images/*. jpg All .jpg files in the images directory and in subdirectories under the images directory. a*.jpg • • All .jpg files for which the file name begins with a, for example, . apple.jpg and appalachian_trail_2012_05_21.jpg All .jpg files for which the file path begins with a, for example, abra/ cadabra/magic.jpg . a??.jpg *.doc* All .jpg files for which the file name begins with a and is followed by exactly two other characters, for example, ant.jpg and abe.jpg. All files for which the file name extension begins with .doc, for example, .doc, .docx, and .docm files. You can't use the path pattern *.doc? in Cache behavior settings 79 Amazon CloudFront Developer Guide Path pattern Files that match the path pattern this case, because that path pattern wouldn't apply to requests for .doc files; the ? wildcard character replaces exactly one character. The maximum length of a path pattern is 255 characters. The value can contain any of the following characters: • A-Z, a-z Path patterns are case-sensitive, so the path pattern *.jpg doesn't apply to the file LOGO.JPG • 0-9 • _ - . * $ / ~ " ' @ : + • &, passed and returned as & Path normalization CloudFront normalizes URI paths consistent with RFC 3986 and then matches the path with the correct cache behavior. Once the cache behavior is matched, CloudFront sends the raw URI path to the origin. If they don't match, requests are instead matched to your default cache behavior. Some characters are normalized and removed from the path, such as multiple slashes (//) or periods (..). This can alter the URL that CloudFront uses to match the intended cache behavior. Example Example You specify the /a/b* and /a* paths for your cache behavior. • A viewer sending the /a/b?c=1 path will match the /a/b* cache behavior. • A viewer sending the /a/b/..?c=1 path will match the /a* cache behavior. To work around the paths being normalized, you can update your request paths or the path pattern for the cache behavior. Origin or origin group This setting applies only when you create or update a cache behavior for an existing distribution. Cache behavior settings 80 Amazon CloudFront Developer Guide Enter the value of an existing origin or origin group. This identifies the origin or origin group to which you want CloudFront to route requests when a request (such as https://example.com/ logo.jpg) matches the path pattern for a cache behavior (such as *.jpg) or for the default cache behavior (*). Viewer protocol policy Choose the protocol policy that you want viewers to use to access your content in CloudFront edge locations: • HTTP and HTTPS: Viewers can use both protocols. • Redirect HTTP to HTTPS: Viewers can use both protocols, but HTTP requests are automatically redirected to HTTPS requests. • HTTPS Only: Viewers can only access your content if they're using HTTPS. For more information, see Require HTTPS for communication between viewers and CloudFront. Allowed HTTP methods Specify the HTTP methods that you want CloudFront to process and forward to your origin: • GET, HEAD: You can use CloudFront only to get objects from your origin or to get object headers. • GET, HEAD, OPTIONS: You can use CloudFront only to get objects from your origin, get object headers, or retrieve a list of the options that your origin server supports. • GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE: You can use CloudFront to get, add, update, and delete objects, and to get object headers. In addition, you can perform other POST operations |
AmazonCloudFront_DevGuide-035 | AmazonCloudFront_DevGuide.pdf | 35 | CloudFront. Allowed HTTP methods Specify the HTTP methods that you want CloudFront to process and forward to your origin: • GET, HEAD: You can use CloudFront only to get objects from your origin or to get object headers. • GET, HEAD, OPTIONS: You can use CloudFront only to get objects from your origin, get object headers, or retrieve a list of the options that your origin server supports. • GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE: You can use CloudFront to get, add, update, and delete objects, and to get object headers. In addition, you can perform other POST operations such as submitting data from a web form. Note If you're using gRPC in your workload, you must select GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE. gRPC workloads require the POST method. For more information, see Using gRPC with CloudFront distributions. CloudFront caches responses to GET and HEAD requests and, optionally, OPTIONS requests. Responses to OPTIONS requests are cached separately from responses to GET and HEAD requests (the OPTIONS method is included in the cache key for OPTIONS requests). CloudFront does not cache responses to requests that use other methods. Cache behavior settings 81 Amazon CloudFront Important Developer Guide If you choose GET, HEAD, OPTIONS or GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE, you might need to restrict access to your Amazon S3 bucket or to your custom origin to prevent users from performing operations that you don't want them to perform. The following examples explain how to restrict access: • If you're using Amazon S3 as an origin for your distribution: Create a CloudFront origin access control to restrict access to your Amazon S3 content, and give permissions to the origin access control. For example, if you configure CloudFront to accept and forward these methods only because you want to use PUT, you must still configure Amazon S3 bucket policies to handle DELETE requests appropriately. For more information, see Restrict access to an Amazon S3 origin. • If you're using a custom origin: Configure your origin server to handle all methods. For example, if you configure CloudFront to accept and forward these methods only because you want to use POST, you must still configure your origin server to handle DELETE requests appropriately. Field-level encryption config If you want to enforce field-level encryption on specific data fields, in the dropdown list, choose a field-level encryption configuration. For more information, see Use field-level encryption to help protect sensitive data. Cached HTTP methods Specify whether you want CloudFront to cache the response from your origin when a viewer submits an OPTIONS request. CloudFront always caches the response to GET and HEAD requests. Allow gRPC requests over HTTP/2 Specify whether you want your distribution to allow gRPC requests. To enable gRPC, select the following settings: • For Allowed HTTP methods, select the GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE methods. gRPC requires the POST method. • Select the gRPC checkbox that appears after you select the POST method. Cache behavior settings 82 Amazon CloudFront Developer Guide • For Supported HTTP versions, select HTTP/2. For more information, see Using gRPC with CloudFront distributions. Cache based on selected request headers Specify whether you want CloudFront to cache objects based on the values of specified headers: • None (improves caching) – CloudFront doesn't cache your objects based on header values. • Allowlist – CloudFront caches your objects based only on the values of the specified headers. Use Allowlist Headers to choose the headers that you want CloudFront to base caching on. • All – CloudFront doesn't cache the objects that are associated with this cache behavior. Instead, CloudFront sends every request to the origin. (Not recommended for Amazon S3 origins.) Regardless of the option that you choose, CloudFront forwards certain headers to your origin and takes specific actions based on the headers that you forward. For more information about how CloudFront handles header forwarding, see HTTP request headers and CloudFront behavior (custom and Amazon S3 origins). For more information about how to configure caching in CloudFront by using request headers, see Cache content based on request headers. Allowlist headers These settings apply only when you choose Allowlist for Cache Based on Selected Request Headers. Specify the headers that you want CloudFront to consider when caching your objects. Select headers from the list of available headers and choose Add. To forward a custom header, enter the name of the header in the field, and choose Add Custom. For the current maximum number of headers that you can allowlist for each cache behavior, or to request a higher quota (formerly known as limit), see Quotas on headers. Object caching If your origin server is adding a Cache-Control header to your objects to control how long the objects stay in the CloudFront cache and if you don't want to |
AmazonCloudFront_DevGuide-036 | AmazonCloudFront_DevGuide.pdf | 36 | headers that you want CloudFront to consider when caching your objects. Select headers from the list of available headers and choose Add. To forward a custom header, enter the name of the header in the field, and choose Add Custom. For the current maximum number of headers that you can allowlist for each cache behavior, or to request a higher quota (formerly known as limit), see Quotas on headers. Object caching If your origin server is adding a Cache-Control header to your objects to control how long the objects stay in the CloudFront cache and if you don't want to change the Cache-Control value, choose Use Origin Cache Headers. Cache behavior settings 83 Amazon CloudFront Developer Guide To specify a minimum and maximum time that your objects stay in the CloudFront cache regardless of Cache-Control headers, and a default time that your objects stay in the CloudFront cache when the Cache-Control header is missing from an object, choose Customize. Then specify values in the Minimum TTL, Default TTL, and Maximum TTL fields. For more information, see Manage how long content stays in the cache (expiration). Minimum TTL Specify the minimum amount of time, in seconds, that you want objects to stay in the CloudFront cache before CloudFront sends another request to the origin to determine whether the object has been updated. For more information, see Manage how long content stays in the cache (expiration). Maximum TTL Specify the maximum amount of time, in seconds, that you want objects to stay in CloudFront caches before CloudFront queries your origin to see whether the object has been updated. The value that you specify for Maximum TTL applies only when your origin adds HTTP headers such as Cache-Control max-age, Cache-Control s-maxage, or Expires to objects. For more information, see Manage how long content stays in the cache (expiration). To specify a value for Maximum TTL, you must choose the Customize option for the Object Caching setting. The default value for Maximum TTL is 31536000 seconds (one year). If you change the value of Minimum TTL or Default TTL to more than 31536000 seconds, then the default value of Maximum TTL changes to the value of Default TTL. Default TTL Specify the default amount of time, in seconds, that you want objects to stay in CloudFront caches before CloudFront forwards another request to your origin to determine whether the object has been updated. The value that you specify for Default TTL applies only when your origin does not add HTTP headers such as Cache-Control max-age, Cache-Control s-maxage, or Expires to objects. For more information, see Manage how long content stays in the cache (expiration). To specify a value for Default TTL, you must choose the Customize option for the Object Caching setting. Cache behavior settings 84 Amazon CloudFront Developer Guide The default value for Default TTL is 86400 seconds (one day). If you change the value of Minimum TTL to more than 86400 seconds, then the default value of Default TTL changes to the value of Minimum TTL. Forward cookies Note For Amazon S3 origins, this option applies to only buckets that are configured as a website endpoint. Specify whether you want CloudFront to forward cookies to your origin server and, if so, which ones. If you choose to forward only selected cookies (an allowlist of cookies), enter the cookie names in the Allowlist Cookies field. If you choose All, CloudFront forwards all cookies regardless of how many your application uses. Amazon S3 doesn't process cookies, and forwarding cookies to the origin reduces cache ability. For cache behaviors that are forwarding requests to an Amazon S3 origin, choose None for Forward Cookies. For more information about forwarding cookies to the origin, go to Cache content based on cookies. Allowlist cookies Note For Amazon S3 origins, this option applies to only buckets that are configured as a website endpoint. If you chose Allowlist in the Forward Cookies list, then in the Allowlist Cookies field, enter the names of cookies that you want CloudFront to forward to your origin server for this cache behavior. Enter each cookie name on a new line. You can specify the following wildcards to specify cookie names: • * matches 0 or more characters in the cookie name Cache behavior settings 85 Amazon CloudFront Developer Guide • ? matches exactly one character in the cookie name For example, suppose viewer requests for an object include a cookie named: userid_member-number Where each of your users has a unique value for member-number. You want CloudFront to cache a separate version of the object for each member. You could accomplish this by forwarding all cookies to your origin, but viewer requests include some cookies that you don't want CloudFront to cache. Alternatively, you could specify the following value as a cookie name, which causes |
AmazonCloudFront_DevGuide-037 | AmazonCloudFront_DevGuide.pdf | 37 | or more characters in the cookie name Cache behavior settings 85 Amazon CloudFront Developer Guide • ? matches exactly one character in the cookie name For example, suppose viewer requests for an object include a cookie named: userid_member-number Where each of your users has a unique value for member-number. You want CloudFront to cache a separate version of the object for each member. You could accomplish this by forwarding all cookies to your origin, but viewer requests include some cookies that you don't want CloudFront to cache. Alternatively, you could specify the following value as a cookie name, which causes CloudFront to forward to the origin all of the cookies that begin with userid_: userid_* For the current maximum number of cookie names that you can allowlist for each cache behavior, or to request a higher quota (formerly known as limit), see Quotas on cookies (legacy cache settings). Query string forwarding and caching CloudFront can cache different versions of your content based on the values of query string parameters. Choose one of the following options: None (Improves Caching) Choose this option if your origin returns the same version of an object regardless of the values of query string parameters. This increases the likelihood that CloudFront can serve a request from the cache, which improves performance and reduces the load on your origin. Forward all, cache based on allowlist Choose this option if your origin server returns different versions of your objects based on one or more query string parameters. Then specify the parameters that you want CloudFront to use as a basis for caching in the Query string allowlist field. Forward all, cache based on all Choose this option if your origin server returns different versions of your objects for all query string parameters. For more information about caching based on query string parameters, including how to improve performance, see Cache content based on query string parameters. Cache behavior settings 86 Amazon CloudFront Query string allowlist Developer Guide This setting applies only when you choose Forward all, cache based on allowlist for Query string forwarding and caching. You can specify the query string parameters that you want CloudFront to use as a basis for caching. Smooth Streaming Choose Yes if you want to distribute media files in the Microsoft Smooth Streaming format and you do not have an IIS server. Choose No if you have a Microsoft IIS server that you want to use as an origin to distribute media files in the Microsoft Smooth Streaming format, or if you are not distributing Smooth Streaming media files. Note If you specify Yes, you can still distribute other content using this cache behavior if that content matches the value of Path Pattern. For more information, see Configure video on demand for Microsoft Smooth Streaming. Restrict viewer access (use signed URLs or signed cookies) If you want requests for objects that match the PathPattern for this cache behavior to use public URLs, choose No. If you want requests for objects that match the PathPattern for this cache behavior to use signed URLs, choose Yes. Then specify the AWS accounts that you want to use to create signed URLs; these accounts are known as trusted signers. For more information about trusted signers, see Specify signers that can create signed URLs and signed cookies. Trusted signers This setting applies only when you choose Yes for Restrict Viewer Access (Use Signed URLs or Signed Cookies. Choose which AWS accounts you want to use as trusted signers for this cache behavior: Cache behavior settings 87 Amazon CloudFront Developer Guide • Self: Use the account with which you're currently signed into the AWS Management Console as a trusted signer. If you're currently signed in as an IAM user, the associated AWS account is added as a trusted signer. • Specify Accounts: Enter account numbers for trusted signers in the AWS Account Numbers field. To create signed URLs, an AWS account must have at least one active CloudFront key pair. Important If you're updating a distribution that you're already using to distribute content, add trusted signers only when you're ready to start generating signed URLs for your objects. After you add trusted signers to a distribution, users must use signed URLs to access the objects that match the PathPattern for this cache behavior. AWS account numbers This setting applies only when you choose Specify Accounts for Trusted Signers. If you want to create signed URLs using AWS accounts in addition to or instead of the current account, enter one AWS account number per line in this field. Note the following: • The accounts that you specify must have at least one active CloudFront key pair. For more information, see Create key pairs for your signers. • You can't create CloudFront key pairs for IAM users, so you can't |
AmazonCloudFront_DevGuide-038 | AmazonCloudFront_DevGuide.pdf | 38 | use signed URLs to access the objects that match the PathPattern for this cache behavior. AWS account numbers This setting applies only when you choose Specify Accounts for Trusted Signers. If you want to create signed URLs using AWS accounts in addition to or instead of the current account, enter one AWS account number per line in this field. Note the following: • The accounts that you specify must have at least one active CloudFront key pair. For more information, see Create key pairs for your signers. • You can't create CloudFront key pairs for IAM users, so you can't use IAM users as trusted signers. • For information about how to get the AWS account number for an account, see View AWS account identifiers in the AWS account Management Reference Guide. • If you enter the account number for the current account, CloudFront automatically checks the Self check box and removes the account number from the AWS Account Numbers list. Compress objects automatically If you want CloudFront to automatically compress files of certain types when viewers support compressed content, choose Yes. When CloudFront compresses your content, downloads are faster because the files are smaller, and your web pages render faster for your users. For more information, see Serve compressed files. Cache behavior settings 88 Amazon CloudFront CloudFront event Developer Guide This setting applies to Lambda Function Associations. You can choose to run a Lambda function when one or more of the following CloudFront events occur: • When CloudFront receives a request from a viewer (viewer request) • Before CloudFront forwards a request to the origin (origin request) • When CloudFront receives a response from the origin (origin response) • Before CloudFront returns the response to the viewer (viewer response) For more information, see Choose the event to trigger the function. Lambda function ARN This setting applies to Lambda Function Associations. Specify the Amazon Resource Name (ARN) of the Lambda function that you want to add a trigger for. To learn how to get the ARN for a function, see step 1 of the procedure Adding Triggers by Using the CloudFront Console. Include body This setting applies to Lambda Function Associations. For more information, see Include body. Distribution settings The following values apply to the entire distribution. Topics • Price class • AWS WAF web ACL • Alternate domain names (CNAMEs) • SSL certificate • Custom SSL client support • Security policy (minimum SSL/TLS version) Distribution settings 89 Developer Guide Amazon CloudFront • Supported HTTP versions • Default root object • Standard logging • Log prefix • Cookie logging • Enable IPv6 • Comment • Distribution state Price class Choose the price class that corresponds with the maximum price that you want to pay for CloudFront service. By default, CloudFront serves your objects from edge locations in all CloudFront Regions. For more information about price classes and about how your choice of price class affects CloudFront performance for your distribution, see CloudFront pricing. AWS WAF web ACL You can protect your CloudFront distribution with AWS WAF, a web application firewall that allows you to secure your web applications and APIs to block requests before they reach your servers. You can Enable AWS WAF for distributions when creating or editing a CloudFront distribution. Optionally, you can later configure additional security protections for other threats specific to your application in the AWS WAF console at https://console.aws.amazon.com/wafv2/. For more information about AWS WAF, see the AWS WAF Developer Guide. Alternate domain names (CNAMEs) Optional. Specify one or more domain names that you want to use for URLs for your objects instead of the domain name that CloudFront assigns when you create your distribution. You must own the domain name, or have authorization to use it, which you verify by adding an SSL/TLS certificate. For example, if you want the URL for the object: /images/image.jpg Distribution settings 90 Amazon CloudFront To look like this: Developer Guide https://www.example.com/images/image.jpg Instead of like this: https://d111111abcdef8.cloudfront.net/images/image.jpg Add a CNAME for www.example.com. Important If you add a CNAME for www.example.com to your distribution, you also must do the following: • Create (or update) a CNAME record with your DNS service to route queries for www.example.com to d111111abcdef8.cloudfront.net. • Add a certificate to CloudFront from a trusted certificate authority (CA) that covers the domain name (CNAME) that you add to your distribution, to validate your authorization to use the domain name. You must have permission to create a CNAME record with the DNS service provider for the domain. Typically, this means that you own the domain, or that you're developing an application for the domain owner. For the current maximum number of alternate domain names that you can add to a distribution, or to request a higher quota (formerly known as limit), see General quotas on distributions. For more information |
AmazonCloudFront_DevGuide-039 | AmazonCloudFront_DevGuide.pdf | 39 | a certificate to CloudFront from a trusted certificate authority (CA) that covers the domain name (CNAME) that you add to your distribution, to validate your authorization to use the domain name. You must have permission to create a CNAME record with the DNS service provider for the domain. Typically, this means that you own the domain, or that you're developing an application for the domain owner. For the current maximum number of alternate domain names that you can add to a distribution, or to request a higher quota (formerly known as limit), see General quotas on distributions. For more information about alternate domain names, see Use custom URLs by adding alternate domain names (CNAMEs). For more information about CloudFront URLs, see Customize the URL format for files in CloudFront. SSL certificate If you specified an alternate domain name to use with your distribution, choose Custom SSL Certificate, and then, to validate your authorization to use the alternate domain name, choose a certificate that covers it. If you want viewers to use HTTPS to access your objects, choose the settings that support that. Distribution settings 91 Amazon CloudFront Developer Guide • Default CloudFront Certificate (*.cloudfront.net) – Choose this option if you want to use the CloudFront domain name in the URLs for your objects, such as https:// d111111abcdef8.cloudfront.net/image1.jpg. • Custom SSL Certificate – Choose this option if you want to use your own domain name in the URLs for your objects as an alternate domain name, such as https://example.com/ image1.jpg. Then choose a certificate to use that covers the alternate domain name. The list of certificates can include any of the following: • Certificates provided by AWS Certificate Manager • Certificates that you purchased from a third-party certificate authority and uploaded to ACM • Certificates that you purchased from a third-party certificate authority and uploaded to the IAM certificate store If you choose this setting, we recommend that you use only an alternate domain name in your object URLs (https://example.com/logo.jpg). If you use your CloudFront distribution domain name (https://d111111abcdef8.cloudfront.net/logo.jpg) and a client uses an older viewer that doesn't support SNI, how the viewer responds depends on the value that you choose for Clients Supported: • All Clients: The viewer displays a warning because the CloudFront domain name doesn't match the domain name in your SSL/TLS certificate. • Only Clients that Support Server Name Indication (SNI): CloudFront drops the connection with the viewer without returning the object. Custom SSL client support Applies only when you choose Custom SSL Certificate (example.com) for SSL Certificate. If you specified one or more alternate domain names and a custom SSL certificate for the distribution, choose how you want CloudFront to serve HTTPS requests: • Clients that Support Server Name Indication (SNI) - (Recommended) – With this setting, virtually all modern web browsers and clients can connect to the distribution, because they support SNI. However, some viewers might use older web browsers or clients that don’t support SNI, which means they can’t connect to the distribution. To apply this setting using the CloudFront API, specify sni-only in the SSLSupportMethod field. In AWS CloudFormation, the field is named SslSupportMethod (note the different capitalization). Distribution settings 92 Amazon CloudFront Developer Guide • Legacy Clients Support – With this setting, older web browsers and clients that don’t support SNI can connect to the distribution. However, this setting incurs additional monthly charges. For the exact price, go to the Amazon CloudFront Pricing page, and search the page for Dedicated IP custom SSL. To apply this setting using the CloudFront API, specify vip in the SSLSupportMethod field. In AWS CloudFormation, the field is named SslSupportMethod (note the different capitalization). For more information, see Choose how CloudFront serves HTTPS requests. Security policy (minimum SSL/TLS version) Specify the security policy that you want CloudFront to use for HTTPS connections with viewers (clients). A security policy determines two settings: • The minimum SSL/TLS protocol that CloudFront uses to communicate with viewers. • The ciphers that CloudFront can use to encrypt the content that it returns to viewers. For more information about the security policies, including the protocols and ciphers that each one includes, see Supported protocols and ciphers between viewers and CloudFront. The security policies that are available depend on the values that you specify for SSL Certificate and Custom SSL Client Support (known as CloudFrontDefaultCertificate and SSLSupportMethod in the CloudFront API): • When SSL Certificate is Default CloudFront Certificate (*.cloudfront.net) (when CloudFrontDefaultCertificate is true in the API), CloudFront automatically sets the security policy to TLSv1. • When SSL Certificate is Custom SSL Certificate (example.com) and Custom SSL Client Support is Clients that Support Server Name Indication (SNI) - (Recommended) (when CloudFrontDefaultCertificate is false and SSLSupportMethod is sni-only in the API), you can choose from the following security policies: • TLSv1.2_2021 • TLSv1.2_2019 • TLSv1.2_2018 |
AmazonCloudFront_DevGuide-040 | AmazonCloudFront_DevGuide.pdf | 40 | that are available depend on the values that you specify for SSL Certificate and Custom SSL Client Support (known as CloudFrontDefaultCertificate and SSLSupportMethod in the CloudFront API): • When SSL Certificate is Default CloudFront Certificate (*.cloudfront.net) (when CloudFrontDefaultCertificate is true in the API), CloudFront automatically sets the security policy to TLSv1. • When SSL Certificate is Custom SSL Certificate (example.com) and Custom SSL Client Support is Clients that Support Server Name Indication (SNI) - (Recommended) (when CloudFrontDefaultCertificate is false and SSLSupportMethod is sni-only in the API), you can choose from the following security policies: • TLSv1.2_2021 • TLSv1.2_2019 • TLSv1.2_2018 • TLSv1.1_2016 • TLSv1_2016 Distribution settings 93 Amazon CloudFront • TLSv1 Developer Guide • When SSL Certificate is Custom SSL Certificate (example.com) and Custom SSL Client Support is Legacy Clients Support (when CloudFrontDefaultCertificate is false and SSLSupportMethod is vip in the API), you can choose from the following security policies: • TLSv1 • SSLv3 In this configuration, the TLSv1.2_2021, TLSv1.2_2019, TLSv1.2_2018, TLSv1.1_2016, and TLSv1_2016 security policies aren’t available in the CloudFront console or API. If you want to use one of these security policies, you have the following options: • Evaluate whether your distribution needs Legacy Clients Support with dedicated IP addresses. If your viewers support server name indication (SNI), we recommend that you update your distribution’s Custom SSL Client Support setting to Clients that Support Server Name Indication (SNI) (set SSLSupportMethod to sni-only in the API). This enables you to use any of the available TLS security policies, and it can also reduce your CloudFront charges. • If you must keep Legacy Clients Support with dedicated IP addresses, you can request one of the other TLS security policies (TLSv1.2_2021, TLSv1.2_2019, TLSv1.2_2018, TLSv1.1_2016, or TLSv1_2016) by creating a case in the AWS Support Center. Note Before you contact AWS Support to request this change, consider the following: • When you add one of these security policies (TLSv1.2_2021, TLSv1.2_2019, TLSv1.2_2018, TLSv1.1_2016, or TLSv1_2016) to a Legacy Clients Support distribution, the security policy is applied to all non-SNI viewer requests for all Legacy Clients Support distributions in your AWS account. However, when viewers send SNI requests to a distribution with Legacy Clients Support, the security policy of that distribution applies. To make sure that your desired security policy is applied to all viewer requests sent to all Legacy Clients Support distributions in your AWS account, add the desired security policy to each distribution individually. • By definition, the new security policy doesn’t support the same ciphers and protocols as the old one. For example, if you chose to upgrade a distribution’s security policy from TLSv1 to TLSv1.1_2016, that distribution will no longer support the DES- CBC3-SHA cipher. For more information about the ciphers and protocols that each Distribution settings 94 Amazon CloudFront Developer Guide security policy supports, see Supported protocols and ciphers between viewers and CloudFront. Supported HTTP versions Choose the HTTP versions that you want your distribution to support when viewers communicate with CloudFront. For viewers and CloudFront to use HTTP/2, viewers must support TLSv1.2 or later, and Server Name Indication (SNI). For viewers and CloudFront to use HTTP/3, viewers must support TLSv1.3 and Server Name Indication (SNI). CloudFront supports HTTP/3 connection migration to allow the viewer to switch networks without losing connection. For more information about connection migration, see Connection Migration at RFC 9000. Note For more information about supported TLSv1.3 ciphers, see Supported protocols and ciphers between viewers and CloudFront. Default root object Optional. The object that you want CloudFront to request from your origin (for example, index.html) when a viewer requests the root URL of your distribution (https:// www.example.com/) instead of an object in your distribution (https://www.example.com/ product-description.html). Specifying a default root object avoids exposing the contents of your distribution. The maximum length of the name is 255 characters. The name can contain any of the following characters: • A-Z, a-z • 0-9 • _ - . * $ / ~ " ' • &, passed and returned as & Distribution settings 95 Amazon CloudFront Developer Guide When you specify the default root object, enter only the object name, for example, index.html. Do not add a / before the object name. For more information, see Specify a default root object. Standard logging Specify if you want CloudFront to log information about each request for an object and store the log files. You can enable or disable logging at any time. There is no extra charge if you enable logging, but you may accrue charges for storing and accessing the files. You can delete the logs at any time. CloudFront supports the following standard logging options: • Standard logging (v2) – You can send logs to delivery destinations, including Amazon CloudWatch Logs, Amazon Data Firehose, and Amazon Simple Storage Service (Amazon S3). • Standard logging (legacy) – You can |
AmazonCloudFront_DevGuide-041 | AmazonCloudFront_DevGuide.pdf | 41 | root object. Standard logging Specify if you want CloudFront to log information about each request for an object and store the log files. You can enable or disable logging at any time. There is no extra charge if you enable logging, but you may accrue charges for storing and accessing the files. You can delete the logs at any time. CloudFront supports the following standard logging options: • Standard logging (v2) – You can send logs to delivery destinations, including Amazon CloudWatch Logs, Amazon Data Firehose, and Amazon Simple Storage Service (Amazon S3). • Standard logging (legacy) – You can only send logs to an Amazon S3 bucket. Log prefix (Optional) If you enable standard logging (legacy), specify the string, if any, that you want CloudFront to prefix to the access log file names for this distribution, for example, exampleprefix/. The trailing slash ( / ) is optional but recommended to simplify browsing your log files. For more information, see Configure standard logging (legacy). Cookie logging If you want CloudFront to include cookies in access logs, choose On. If you choose to include cookies in logs, CloudFront logs all cookies regardless of how you configure the cache behaviors for this distribution: forward all cookies, forward no cookies, or forward a specified list of cookies to the origin. Amazon S3 doesn't process cookies, so unless your distribution also includes an Amazon EC2 or other custom origin, we recommend that you choose Off for the value of Cookie Logging. For more information about cookies, see Cache content based on cookies. Enable IPv6 IPv6 is a new version of the IP protocol. It's the eventual replacement for IPv4 and uses a larger address space. CloudFront always responds to IPv4 requests. If you want CloudFront to respond Distribution settings 96 Amazon CloudFront Developer Guide to requests from IPv4 IP addresses (such as 192.0.2.44) and requests from IPv6 addresses (such as 2001:0db8:85a3::8a2e:0370:7334), select Enable IPv6. In general, you should enable IPv6 if you have users on IPv6 networks who want to access your content. However, if you're using signed URLs or signed cookies to restrict access to your content, and if you're using a custom policy that includes the IpAddress parameter to restrict the IP addresses that can access your content, do not enable IPv6. If you want to restrict access to some content by IP address and not restrict access to other content (or restrict access but not by IP address), you can create two distributions. For information about creating signed URLs by using a custom policy, see Create a signed URL using a custom policy. For information about creating signed cookies by using a custom policy, see Set signed cookies using a custom policy. If you're using a Route 53 alias resource record set to route traffic to your CloudFront distribution, you need to create a second alias resource record set when both of the following are true: • You enable IPv6 for the distribution • You're using alternate domain names in the URLs for your objects For more information, see Routing traffic to an Amazon CloudFront distribution by using your domain name in the Amazon Route 53 Developer Guide. If you created a CNAME resource record set, either with Route 53 or with another DNS service, you don't need to make any changes. A CNAME record routes traffic to your distribution regardless of the IP address format of the viewer request. If you enable IPv6 and CloudFront access logs, the c-ip column includes values in IPv4 and IPv6 format. For more information, see Log file fields. Note To maintain high customer availability, CloudFront responds to viewer requests by using IPv4 if our data suggests that IPv4 will provide a better user experience. To find out what percentage of requests CloudFront is serving over IPv6, enable CloudFront logging for your distribution and parse the c-ip column, which contains the IP address of the viewer that made the request. This percentage should grow over time, but it will remain a minority of traffic as IPv6 is not yet supported by all viewer networks globally. Some viewer networks have excellent IPv6 support, but others don't support IPv6 at all. (A viewer network is analogous to your home internet or wireless carrier.) Distribution settings 97 Amazon CloudFront Developer Guide For more information about our support for IPv6, see the CloudFront FAQ. For information about enabling access logs, see the fields Standard logging, and Log prefix. Comment Optional. When you create a distribution, you can include a comment of up to 128 characters. You can update the comment at any time. Distribution state Indicates whether you want the distribution to be enabled or disabled once it's deployed: • Enabled means that as soon as the distribution is fully deployed you can deploy links that use the distribution's |
AmazonCloudFront_DevGuide-042 | AmazonCloudFront_DevGuide.pdf | 42 | your home internet or wireless carrier.) Distribution settings 97 Amazon CloudFront Developer Guide For more information about our support for IPv6, see the CloudFront FAQ. For information about enabling access logs, see the fields Standard logging, and Log prefix. Comment Optional. When you create a distribution, you can include a comment of up to 128 characters. You can update the comment at any time. Distribution state Indicates whether you want the distribution to be enabled or disabled once it's deployed: • Enabled means that as soon as the distribution is fully deployed you can deploy links that use the distribution's domain name and users can retrieve content. Whenever a distribution is enabled, CloudFront accepts and handles any end-user requests for content that use the domain name associated with that distribution. When you create, modify, or delete a CloudFront distribution, it takes time for your changes to propagate to the CloudFront database. An immediate request for information about a distribution might not show the change. Propagation usually completes within minutes, but a high system load or network partition might increase this time. • Disabled means that even though the distribution might be deployed and ready to use, users can't use it. Whenever a distribution is disabled, CloudFront doesn't accept any end-user requests that use the domain name associated with that distribution. Until you switch the distribution from disabled to enabled (by updating the distribution's configuration), no one can use it. You can toggle a distribution between disabled and enabled as often as you want. Follow the process for updating a distribution's configuration. For more information, see Update a distribution. Custom error pages and error caching You can have CloudFront return an object to the viewer (for example, an HTML file) when your Amazon S3 or custom origin returns an HTTP 4xx or 5xx status code to CloudFront. You can also specify how long an error response from your origin or a custom error page is cached in CloudFront edge caches. For more information, see Create a custom error page for specific HTTP status codes. Custom error pages and error caching 98 Amazon CloudFront Note Developer Guide The following values aren't included in the Create Distribution wizard, so you can configure custom error pages only when you update a distribution. Topics • HTTP error code • Response page path • HTTP response code • Error caching minimum TTL (seconds) HTTP error code The HTTP status code for which you want CloudFront to return a custom error page. You can configure CloudFront to return custom error pages for none, some, or all of the HTTP status codes that CloudFront caches. Response page path The path to the custom error page (for example, /4xx-errors/403-forbidden.html) that you want CloudFront to return to a viewer when your origin returns the HTTP status code that you specified for Error Code (for example, 403). If you want to store your objects and your custom error pages in different locations, your distribution must include a cache behavior for which the following is true: • The value of Path Pattern matches the path to your custom error messages. For example, suppose you saved custom error pages for 4xx errors in an Amazon S3 bucket in a directory named /4xx-errors. Your distribution must include a cache behavior for which the path pattern routes requests for your custom error pages to that location, for example, /4xx-errors/*. • The value of Origin specifies the value of Origin ID for the origin that contains your custom error pages. HTTP response code The HTTP status code that you want CloudFront to return to the viewer along with the custom error page. Custom error pages and error caching 99 Amazon CloudFront Developer Guide Error caching minimum TTL (seconds) The minimum amount of time that you want CloudFront to cache error responses from your origin server. Geographic restrictions If you need to prevent users in selected countries from accessing your content, you can configure your CloudFront distribution with an Allowlist or a Block list. There is no additional charge for configuring geographic restrictions. For more information, see Restrict the geographic distribution of your content. Test a distribution After you've created your distribution, CloudFront knows where your origin server is, and you know the domain name associated with the distribution. To test your distribution, do the following: 1. Wait until your distribution is deployed. • View your distribution Details in the console. When your distribution is done deploying, the Last modified field changes from Deploying to a date and time. 2. Create links to your objects with the CloudFront domain name by using the following procedure. 3. Test the links. CloudFront serves the objects to your webpage or application. Create links to your objects Use the following procedure to create test links for the objects in your CloudFront |
AmazonCloudFront_DevGuide-043 | AmazonCloudFront_DevGuide.pdf | 43 | server is, and you know the domain name associated with the distribution. To test your distribution, do the following: 1. Wait until your distribution is deployed. • View your distribution Details in the console. When your distribution is done deploying, the Last modified field changes from Deploying to a date and time. 2. Create links to your objects with the CloudFront domain name by using the following procedure. 3. Test the links. CloudFront serves the objects to your webpage or application. Create links to your objects Use the following procedure to create test links for the objects in your CloudFront web distribution. To create links to objects in a web distribution 1. Copy the following HTML code into a new file, replace domain-name with your distribution's domain name, and replace object-name with the name of your object. <html> <head>My CloudFront Test</head> <body> <p>My text content goes here.</p> <p><img src="https://domain-name/object-name" alt="my test image" </body> Geographic restrictions 100 Amazon CloudFront </html> Developer Guide For example, if your domain name were d111111abcdef8.cloudfront.net and your object were image.jpg, the URL for the link would be: https://d111111abcdef8.cloudfront.net/image.jpg. If your object is in a folder on your origin server, then the folder must also be included in the URL. For example, if image.jpg were located in the images folder on your origin server, then the URL would be: https://d111111abcdef8.cloudfront.net/images/image.jpg 2. Save the HTML code in a file that has an .html file name extension. 3. Open your webpage in a browser to ensure that you can see your object. The browser returns your page with the embedded image file, served from the edge location that CloudFront determined was appropriate to serve the object. Update a distribution In the CloudFront console, you can see the CloudFront distributions that are associated with your AWS account, view the settings for a distribution, and update most settings. Be aware that settings changes that you make won't take effect until the distribution has propagated to the AWS edge locations. Update a distribution in the console The following procedures show you how to update a CloudFront distribution in the console. Multi-tenant To update a multi-tenant distribution 1. Sign in to the AWS Management Console and open the CloudFront console at https:// console.aws.amazon.com/cloudfront/v4/home. 2. Search for and choose the ID of the multi-tenant distribution. 3. Choose the tab for the settings you want to update. Update a distribution 101 Amazon CloudFront Developer Guide 4. Make the updates, and then, to save your changes, choose Save changes. For more information about the settings you can update, see CloudFront multi-tenant distribution reference. You can also update a distribution by using the CloudFront API: • To update a distribution, see UpdateDistribution in the Amazon CloudFront API Reference. Important When you update your distribution, be aware that a number of additional fields are required that are not required when you first create a distribution. To help make sure that all of the required fields are included when you use the CloudFront API to update a distribution, follow the steps described in UpdateDistribution in the Amazon CloudFront API Reference. To change the multi-tenant distribution for a distribution tenant, you update the distribution tenant. You also update the distribution tenant to update its domain, certificate, customizations, or parameter values. For more details about updating the distribution tenant certificate, see Add a domain and certificate (distribution tenant). To update a distribution tenant 1. Sign in to the AWS Management Console and open the CloudFront console at https:// console.aws.amazon.com/cloudfront/v4/home. 2. Under SaaS, choose Distribution tenants. 3. Search for the distribution tenant. Use the dropdown menu in the search bar to filter by domain, name, distribution ID, certificate ID, connection group ID, or web ACL ID. 4. Choose the distribution tenant's name. 5. To update general Details, choose Edit, make the updates, and choose Update distribution tenant. 6. Choose the appropriate tab for any other settings to update, make your updates, and save them. For more information about the distribution tenant settings you can customize, see Distribution tenant customizations. Update a distribution in the console 102 Amazon CloudFront Standard To update a standard distribution Developer Guide 1. Sign in to the AWS Management Console and open the CloudFront console at https:// console.aws.amazon.com/cloudfront/v4/home. 2. Select the ID of a distribution. The list includes all of the distributions associated with the AWS account that you used to sign in to the CloudFront console. 3. To update general settings, choose Edit. Otherwise, choose the tab for the settings that you want to update. 4. Make the updates, and then choose Save changes. For information about the fields, see the following topics: • General settings: Distribution settings • Origin settings: Origin settings • Cache behavior settings: Cache behavior settings 5. If you want to delete an origin in your distribution, do the following: a. Choose Behaviors, |
AmazonCloudFront_DevGuide-044 | AmazonCloudFront_DevGuide.pdf | 44 | 2. Select the ID of a distribution. The list includes all of the distributions associated with the AWS account that you used to sign in to the CloudFront console. 3. To update general settings, choose Edit. Otherwise, choose the tab for the settings that you want to update. 4. Make the updates, and then choose Save changes. For information about the fields, see the following topics: • General settings: Distribution settings • Origin settings: Origin settings • Cache behavior settings: Cache behavior settings 5. If you want to delete an origin in your distribution, do the following: a. Choose Behaviors, and then make sure you have moved any default cache behaviors associated with the origin to another origin. b. Choose Origins, and then select an origin. c. Choose Delete. You can also update a distribution by using the CloudFront API: • To update a distribution, see UpdateDistribution in the Amazon CloudFront API Reference. Important When you update your distribution, be aware that a number of additional fields are required that are not required to create a distribution. To help make sure that all of the required fields are included when you use the CloudFront API to update a distribution, follow the steps described in UpdateDistribution in the Amazon CloudFront API Reference. Update a distribution in the console 103 Amazon CloudFront Developer Guide When you save changes to your distribution configuration, CloudFront starts to propagate the changes to all edge locations. Successive configuration changes propagate in their respective order. Until your configuration is updated in an edge location, CloudFront continues to serve your content from that location based on the previous configuration. After your configuration is updated in an edge location, CloudFront immediately starts to serve your content from that location based on the new configuration. Your changes don't propagate to every edge location at the same time. While CloudFront is propagating your changes, we can't determine whether a given edge location is serving your content based on the previous configuration or the new configuration. Note In rare cases when a host or network link is disrupted, some distribution tenant traffic might be served using older configurations for a brief period until your changes make their way through the network. To see when your changes are propagated, view your distribution Details in the console. The Last modified field changes from Deploying to a date and time when deployment is complete. Tag a distribution Tags are words or phrases that you can use to identify and organize your AWS resources. You can add multiple tags to each resource, and each tag includes a key and a value that you define. For example, the key might be "domain" and the value might be "example.com". You can search and filter your resources based on the tags you add. You can use tags with CloudFront, such as the following examples: • Enforce tag-based permissions on CloudFront distributions. For more information, see ABAC with CloudFront. • Track billing information in different categories. When you apply tags to CloudFront distributions or other AWS resources (such as Amazon EC2 instances or Amazon S3 buckets) and activate the tags, AWS generates a cost allocation report as a comma-separated value (CSV file) with your usage and costs aggregated by your active tags. Tag a distribution 104 Amazon CloudFront Developer Guide You can apply tags that represent business categories (such as cost centers, application names, or owners) to organize your costs across multiple services. For more information about using tags for cost allocation, see Using cost allocation tags in the AWS Billing User Guide. Notes • You can tag distributions, but you can't tag origin access identities or invalidations. • Tag Editor and Resource groups aren't currently supported for CloudFront. • For the current maximum number of tags that you can add to a distribution, see General quotas. Contents • Tag restrictions • Add, edit, and delete tags for distributions • Programmatic tagging Tag restrictions The following basic restrictions apply to tags: • For the maximum number of tags per distribution, see General quotas. • Maximum key length – 128 Unicode characters • Maximum value length – 256 Unicode characters • Valid values for key and value – a-z, A-Z, 0-9, space, and the following characters: _ . : / = + - and @ • Tag keys and values are case sensitive • Don't use aws: as a prefix for keys. This prefix is reserved for AWS use. Add, edit, and delete tags for distributions You can use the CloudFront console to manage tags for your distributions. Tag restrictions 105 Amazon CloudFront Developer Guide To add tags, edit, or delete tags for a distribution 1. Sign in to the AWS Management Console and open the CloudFront console at https:// console.aws.amazon.com/cloudfront/v4/home. 2. Choose the ID for the distribution that you want |
AmazonCloudFront_DevGuide-045 | AmazonCloudFront_DevGuide.pdf | 45 | space, and the following characters: _ . : / = + - and @ • Tag keys and values are case sensitive • Don't use aws: as a prefix for keys. This prefix is reserved for AWS use. Add, edit, and delete tags for distributions You can use the CloudFront console to manage tags for your distributions. Tag restrictions 105 Amazon CloudFront Developer Guide To add tags, edit, or delete tags for a distribution 1. Sign in to the AWS Management Console and open the CloudFront console at https:// console.aws.amazon.com/cloudfront/v4/home. 2. Choose the ID for the distribution that you want to update. 3. Choose the Tags tab. 4. Choose Manage tags. 5. On the Manage tags page, you can do the following: • To add a tag, enter a key and, optionally, a value for the tag. Choose Add new tag to add more tags. • To edit a tag, change the tag’s key or its value, or both. You can delete the value for a tag, but the key is required. • To delete a tag, choose Remove. 6. Choose Save changes. Programmatic tagging You can also use the CloudFront API, AWS Command Line Interface (AWS CLI), AWS SDKs, and AWS Tools for Windows PowerShell to apply tags. For more information, see the following topics: • CloudFront API operations: • ListTagsForResource • TagResource • UntagResource • AWS CLI – See cloudfront in the AWS CLI Command Reference • AWS SDKs – See the applicable SDK documentation on the AWS Documentation page • Tools for Windows PowerShell – See Amazon CloudFront in the AWS Tools for PowerShell Cmdlet Reference Programmatic tagging 106 Amazon CloudFront Developer Guide Delete a distribution The following procedure deletes a distribution by using the CloudFront console. For information about deleting with the CloudFront API, see DeleteDistribution in the Amazon CloudFront API Reference. If you need to delete a distribution with an OAC attached to an S3 bucket, see Delete a distribution with an OAC attached to an S3 bucket for important details. Note Be aware that before you can delete a distribution, you must disable it, which requires permission to update the distribution. If you disable a distribution that has an alternate domain name associated with it, CloudFront stops accepting traffic for that domain name (such as www.example.com), even if another distribution has an alternate domain name with a wildcard (*) that matches the same domain (such as *.example.com). Multi-tenant Before you can delete a multi-tenant distribution, you must first delete all associated distribution tenants from it. To delete a multi-tenant distribution 1. Sign in to the AWS Management Console and open the CloudFront console at https:// console.aws.amazon.com/cloudfront/v4/home. 2. In the right pane of the CloudFront console, choose the name of the multi-tenant distribution that you want to delete. 3. For Tenants, select and delete all associated distribution tenants. 4. Choose Disable to disable the distribution, and choose Disable distribution to confirm. 5. Wait until the new timestamp appears under the Last modified column. • It might take a few minutes for CloudFront to propagate your change to all edge locations. 6. Choose Delete, Delete distribution. Delete a distribution 107 Amazon CloudFront Developer Guide To delete a distribution tenant 1. Sign in to the AWS Management Console and open the CloudFront console at https:// console.aws.amazon.com/cloudfront/v4/home. 2. Under SaaS, choose Distribution tenants. 3. Search for the distribution tenant. Use the dropdown menu in the search bar to filter by domain, name, distribution ID, certificate ID, connection group ID, or web ACL ID. 4. Select the distribution tenant to delete. 5. Choose Delete tenant, Delete distribution tenant. Standard To delete a standard distribution 1. Sign in to the AWS Management Console and open the CloudFront console at https:// console.aws.amazon.com/cloudfront/v4/home. 2. In the right pane of the CloudFront console, find the distribution that you want to delete. • If the Status column shows that the distribution is already Disabled, skip to Step 6. • If the Status shows Enabled but the distribution still shows Deploying in the Last modified column, wait for deployment to finish before continuing to step 3. 3. In the right pane of the CloudFront console, select the check box for the distribution that you want to delete. 4. Choose Disable to disable the distribution, and choose Yes, Disable to confirm. Then choose Close. • The value of the Status column immediately changes to Disabled. 5. Wait until the new timestamp appears under the Last modified column. • It might take a few minutes for CloudFront to propagate your change to all edge locations. 6. Select the check box for the distribution that you want to delete. 7. Choose Delete, Delete. Delete a distribution 108 Amazon CloudFront Developer Guide • If the Delete option isn't available, it means that CloudFront is still propagating your change to |
AmazonCloudFront_DevGuide-046 | AmazonCloudFront_DevGuide.pdf | 46 | to delete. 4. Choose Disable to disable the distribution, and choose Yes, Disable to confirm. Then choose Close. • The value of the Status column immediately changes to Disabled. 5. Wait until the new timestamp appears under the Last modified column. • It might take a few minutes for CloudFront to propagate your change to all edge locations. 6. Select the check box for the distribution that you want to delete. 7. Choose Delete, Delete. Delete a distribution 108 Amazon CloudFront Developer Guide • If the Delete option isn't available, it means that CloudFront is still propagating your change to the edge locations. Wait until the new timestamp appears under the Last modified column, then repeat steps 6-7. Use various origins with CloudFront distributions When you create a distribution, you specify the origin where CloudFront sends requests for the files. You can use several different kinds of origins with CloudFront. For example, you can use an Amazon S3 bucket, a MediaStore container, a MediaPackage channel, an Application Load Balancer, or an AWS Lambda function URL. If you have an Application Load Balancer, Network Load Balancer, or EC2 instance in a private subnet, you can use it as a VPC origin. VPC origins prevent your application from being accessible on the public internet. For more information, see the section called “Restrict access with VPC origins”. Note You can use edge functions to dynamically select the appropriate origin for each request. By using CloudFront Functions or Lambda@Edge, you can route requests to different origins based on factors such as the viewer's geographic location, the request headers, or query string parameters. For more information, see Customize at the edge with functions. Topics • Use an Amazon S3 bucket • Use a MediaStore container or a MediaPackage channel • Use an Application Load Balancer • Use a Lambda function URL • Use Amazon EC2 (or another custom origin) • Use CloudFront origin groups • Use Amazon API Gateway Use various origins 109 Amazon CloudFront Developer Guide Use an Amazon S3 bucket The following topics describe the different ways that you can use an Amazon S3 bucket as the origin for a CloudFront distribution. Topics • Use a standard Amazon S3 bucket • Use Amazon S3 Object Lambda • Use Amazon S3 Access Point • Use an Amazon S3 bucket that's configured as a website endpoint • Add CloudFront to an existing Amazon S3 bucket • Move an Amazon S3 bucket to a different AWS Region Use a standard Amazon S3 bucket When you use Amazon S3 as an origin for your distribution, you place the objects that you want CloudFront to deliver in an Amazon S3 bucket. You can use any method that is supported by Amazon S3 to get your objects into Amazon S3. For example, you can use the Amazon S3 console or API, or a third-party tool. You can create a hierarchy in your bucket to store the objects, just as you would with any other standard Amazon S3 bucket. Using an existing Amazon S3 bucket as your CloudFront origin server doesn't change the bucket in any way; you can still use it as you normally would to store and access Amazon S3 objects at the standard Amazon S3 price. You incur regular Amazon S3 charges for storing the objects in the bucket. For more information about the charges to use CloudFront, see Amazon CloudFront Pricing. For more information about using CloudFront with an existing S3 bucket, see the section called “Add CloudFront to an existing Amazon S3 bucket”. Important For your bucket to work with CloudFront, the name must conform to DNS naming requirements. For more information, go to Bucket naming rules in the Amazon Simple Storage Service User Guide. When you specify an Amazon S3 bucket as an origin for CloudFront, we recommend that you use the following format: Use an Amazon S3 bucket 110 Amazon CloudFront Developer Guide bucket-name.s3.region.amazonaws.com When you specify the bucket name in this format, you can use the following CloudFront features: • Configure CloudFront to communicate with your Amazon S3 bucket using SSL/TLS. For more information, see the section called “Use HTTPS with CloudFront”. • Use an origin access control to require that viewers access your content using CloudFront URLs, not by using Amazon S3 URLs. For more information, see the section called “Restrict access to an Amazon S3 origin”. • Update the content of your bucket by submitting POST and PUT requests to CloudFront. For more information, see the section called “HTTP methods” in the topic the section called “How CloudFront processes and forwards requests to your Amazon S3 origin”. Don't specify the bucket using the following formats: • The Amazon S3 path style: s3.amazonaws.com/bucket-name • The Amazon S3 CNAME Use Amazon S3 Object Lambda When you create an Object Lambda Access Point, |
AmazonCloudFront_DevGuide-047 | AmazonCloudFront_DevGuide.pdf | 47 | access your content using CloudFront URLs, not by using Amazon S3 URLs. For more information, see the section called “Restrict access to an Amazon S3 origin”. • Update the content of your bucket by submitting POST and PUT requests to CloudFront. For more information, see the section called “HTTP methods” in the topic the section called “How CloudFront processes and forwards requests to your Amazon S3 origin”. Don't specify the bucket using the following formats: • The Amazon S3 path style: s3.amazonaws.com/bucket-name • The Amazon S3 CNAME Use Amazon S3 Object Lambda When you create an Object Lambda Access Point, Amazon S3 automatically generates a unique alias for your Object Lambda Access Point. You can use this alias instead of an Amazon S3 bucket name as an origin for your CloudFront distribution. When you use an Object Lambda Access Point alias as an origin for CloudFront, we recommend that you use the following format: alias.s3.region.amazonaws.com For more information about finding the alias, see How to use a bucket-style alias for your S3 bucket Object Lambda Access Point in the Amazon S3 User Guide. Important When you use an Object Lambda Access Point as an origin for CloudFront, you must use origin access control. Use an Amazon S3 bucket 111 Amazon CloudFront Developer Guide For an example use case, see Use Amazon S3 Object Lambda with Amazon CloudFront to Tailor Content for End Users. CloudFront treats an Object Lambda Access Point origin the same as a standard Amazon S3 bucket origin. If you're using Amazon S3 Object Lambda as an origin for your distribution, you must configure the following four permissions. Object Lambda Access Point To add permissions for the Object Lambda Access Point 1. Sign in to the AWS Management Console and open the Amazon S3 console at https:// console.aws.amazon.com/s3/. 2. In the navigation pane, choose Object Lambda Access Points. 3. Choose the Object Lambda Access Point that you want to use. 4. Choose the Permissions tab. 5. Choose Edit in the Object Lambda Access Point policy section. 6. Paste the following policy into the Policy field. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "cloudfront.amazonaws.com" }, "Action": "s3-object-lambda:Get*", "Resource": "arn:aws:s3-object-lambda:region:AWS-account- ID:accesspoint/Object-Lambda-Access-Point-name", "Condition": { "StringEquals": { "aws:SourceArn": "arn:aws:cloudfront::AWS-account- ID:distribution/CloudFront-distribution-ID" } } } ] Use an Amazon S3 bucket 112 Amazon CloudFront } 7. Choose Save changes. Amazon S3 Access Point Developer Guide To add permissions for the Amazon S3 Access Point 1. Sign in to the AWS Management Console and open the Amazon S3 console at https:// console.aws.amazon.com/s3/. 2. In the navigation pane, choose Access Points. 3. Choose the Amazon S3 Access Point that you want to use. 4. Choose the Permissions tab. 5. Choose Edit in the Access Point policy section. 6. Paste the following policy into the Policy field. { "Version": "2012-10-17", "Id": "default", "Statement": [ { "Sid": "s3objlambda", "Effect": "Allow", "Principal": { "Service": "cloudfront.amazonaws.com" }, "Action": "s3:*", "Resource": [ "arn:aws:s3:region:AWS-account-ID:accesspoint/Access-Point- name", "arn:aws:s3:region:AWS-account-ID:accesspoint/Access-Point-name/ object/*" ], "Condition": { "ForAnyValue:StringEquals": { "aws:CalledVia": "s3-object-lambda.amazonaws.com" } } } ] Use an Amazon S3 bucket 113 Amazon CloudFront } 7. Choose Save. Amazon S3 bucket Developer Guide To add permissions to the Amazon S3 bucket 1. Sign in to the AWS Management Console and open the Amazon S3 console at https:// console.aws.amazon.com/s3/. 2. In the navigation pane, choose Buckets. 3. Choose the Amazon S3 bucket that you want to use. 4. Choose the Permissions tab. 5. Choose Edit in the Bucket policy section. 6. Paste the following policy into the Policy field. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "AWS": "*" }, "Action": "*", "Resource": [ "arn:aws:s3:::bucket-name", "arn:aws:s3:::bucket-name/*" ], "Condition": { "StringEquals": { "s3:DataAccessPointAccount": "AWS-account-ID" } } } ] } 7. Choose Save changes. Use an Amazon S3 bucket 114 Amazon CloudFront AWS Lambda function To add permissions to the Lambda function Developer Guide 1. Sign in to the AWS Management Console and open the AWS Lambda console at https:// console.aws.amazon.com/lambda/. 2. In the navigation pane, choose Functions. 3. Choose the AWS Lambda function that you want to use. 4. Choose the Configuration tab, then choose Permissions. 5. Choose Add permissions in the Resource-based policy statements section. 6. Choose AWS account. 7. 8. Enter a name for Statement ID. Enter cloudfront.amazonaws.com for Principal. 9. Choose lambda:InvokeFunction from the Action dropdown menu. 10. Choose Save. Use Amazon S3 Access Point When you use an S3 Access Point, Amazon S3 automatically generates a unique alias for you. You can use this alias instead of an Amazon S3 bucket name as an origin for your CloudFront distribution. When you use an Amazon S3 Access Point alias as an origin for CloudFront, we recommend that you use the following format: alias.s3.region.amazonaws.com For more information about finding the alias, see Using a bucket-style alias for your S3 bucket access point in the |
AmazonCloudFront_DevGuide-048 | AmazonCloudFront_DevGuide.pdf | 48 | Statement ID. Enter cloudfront.amazonaws.com for Principal. 9. Choose lambda:InvokeFunction from the Action dropdown menu. 10. Choose Save. Use Amazon S3 Access Point When you use an S3 Access Point, Amazon S3 automatically generates a unique alias for you. You can use this alias instead of an Amazon S3 bucket name as an origin for your CloudFront distribution. When you use an Amazon S3 Access Point alias as an origin for CloudFront, we recommend that you use the following format: alias.s3.region.amazonaws.com For more information about finding the alias, see Using a bucket-style alias for your S3 bucket access point in the Amazon S3 User Guide. Important When you use an Amazon S3 Access Point as an origin for CloudFront, you must use origin access control. Use an Amazon S3 bucket 115 Amazon CloudFront Developer Guide CloudFront treats an Amazon S3 Access Point origin the same as a standard Amazon S3 bucket origin. If you're using Amazon S3 Object Lambda as an origin for your distribution, you must configure the following two permissions. Amazon S3 Access Point To add permissions for the Amazon S3 Access Point 1. Sign in to the AWS Management Console and open the Amazon S3 console at https:// console.aws.amazon.com/s3/. 2. In the navigation pane, choose Access Points. 3. Choose the Amazon S3 Access Point that you want to use. 4. Choose the Permissions tab. 5. Choose Edit in the Access Point policy section. 6. Paste the following policy into the Policy field. { "Version": "2012-10-17", "Id": "default", "Statement": [ { "Sid": "s3objlambda", "Effect": "Allow", "Principal": {"Service": "cloudfront.amazonaws.com"}, "Action": "s3:*", "Resource": [ "arn:aws:s3:region:AWS-account-ID:accesspoint/Access-Point- name", "arn:aws:s3:region:AWS-account-ID:accesspoint/Access-Point-name/ object/*" ], "Condition": { "StringEquals": {"aws:SourceArn": "arn:aws:cloudfront::AWS- account-ID:distribution/CloudFront-distribution-ID"} } } ] } Use an Amazon S3 bucket 116 Amazon CloudFront 7. Choose Save. Amazon S3 bucket Developer Guide To add permissions to the Amazon S3 bucket 1. Sign in to the AWS Management Console and open the Amazon S3 console at https:// console.aws.amazon.com/s3/. 2. In the navigation pane, choose Buckets. 3. Choose the Amazon S3 bucket that you want to use. 4. Choose the Permissions tab. 5. Choose Edit in the Bucket policy section. 6. Paste the following policy into the Policy field. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "AWS": "*" }, "Action": "*", "Resource": [ "arn:aws:s3:::bucket-name", "arn:aws:s3:::bucket-name/*" ], "Condition": { "StringEquals": { "s3:DataAccessPointAccount": "AWS-account-ID" } } } ] } 7. Choose Save changes. Use an Amazon S3 bucket 117 Amazon CloudFront Developer Guide Use an Amazon S3 bucket that's configured as a website endpoint You can use an Amazon S3 bucket that's configured as a website endpoint as a custom origin with CloudFront. When you configure your CloudFront distribution, for the origin, enter the Amazon S3 static website hosting endpoint for your bucket. This value appears in the Amazon S3 console, on the Properties tab, in the Static website hosting pane. For example: http://bucket-name.s3-website-region.amazonaws.com For more information about specifying Amazon S3 static website endpoints, see Website endpoints in the Amazon Simple Storage Service User Guide. When you specify the bucket name in this format as your origin, you can use Amazon S3 redirects and Amazon S3 custom error documents. For more information, see Configuring a custom error document and Configuring a redirect in the Amazon Simple Storage Service User Guide. (CloudFront also provides custom error pages. For more information, see the section called “Create a custom error page for specific HTTP status codes”.) Using an Amazon S3 bucket as your CloudFront origin server doesn't change the bucket in any way. You can still use it as you normally would and you incur regular Amazon S3 charges. For more information about the charges to use CloudFront, see Amazon CloudFront Pricing. Note If you use the CloudFront API to create your distribution with an Amazon S3 bucket that is configured as a website endpoint, you must configure it by using CustomOriginConfig, even though the website is hosted in an Amazon S3 bucket. For more information about creating distributions by using the CloudFront API, see CreateDistribution in the Amazon CloudFront API Reference. Add CloudFront to an existing Amazon S3 bucket If you store your objects in an Amazon S3 bucket, you can either have users get your objects directly from S3, or you can configure CloudFront to get your objects from S3 and then distribute them to your users. Using CloudFront can be more cost effective if your users access your objects frequently because, at higher usage, the price for CloudFront data transfer is lower than the price for Amazon S3 data transfer. In addition, downloads are faster with CloudFront than with Amazon S3 alone because your objects are stored closer to your users. Use an Amazon S3 bucket 118 Amazon CloudFront Note Developer Guide If you want CloudFront to respect Amazon S3 cross-origin resource sharing settings, configure CloudFront to forward the |
AmazonCloudFront_DevGuide-049 | AmazonCloudFront_DevGuide.pdf | 49 | you can configure CloudFront to get your objects from S3 and then distribute them to your users. Using CloudFront can be more cost effective if your users access your objects frequently because, at higher usage, the price for CloudFront data transfer is lower than the price for Amazon S3 data transfer. In addition, downloads are faster with CloudFront than with Amazon S3 alone because your objects are stored closer to your users. Use an Amazon S3 bucket 118 Amazon CloudFront Note Developer Guide If you want CloudFront to respect Amazon S3 cross-origin resource sharing settings, configure CloudFront to forward the Origin header to Amazon S3. For more information, see the section called “Cache content based on request headers”. If you currently distribute content directly from your Amazon S3 bucket using your own domain name (such as example.com) instead of the domain name of your Amazon S3 bucket (such as amzn-s3-demo-bucket.s3.us-west-2.amazonaws.com), you can add CloudFront with no disruption by using the following procedure. To add CloudFront when you're already distributing your content from Amazon S3 1. Create a CloudFront distribution. For more information, see the section called “Create a distribution”. When you create the distribution, specify the name of your Amazon S3 bucket as the origin server. Important For your bucket to work with CloudFront, the name must conform to DNS naming requirements. For more information, go to Bucket naming rules in the Amazon Simple Storage Service User Guide. If you're using a CNAME with Amazon S3, specify the CNAME for your distribution, too. 2. Create a test webpage that contains links to publicly readable objects in your Amazon S3 bucket, and test the links. For this initial test, use the CloudFront domain name of your distribution in the object URLs, for example, https://d111111abcdef8.cloudfront.net/ images/image.jpg. For more information about the format of CloudFront URLs, see the section called “Customize file URLs”. 3. If you're using Amazon S3 CNAMEs, your application uses your domain name (for example, example.com) to reference the objects in your Amazon S3 bucket instead of using the name of your bucket (for example, amzn-s3-demo-bucket.s3.amazonaws.com). To continue using Use an Amazon S3 bucket 119 Amazon CloudFront Developer Guide your domain name to reference objects instead of using the CloudFront domain name for your distribution (for example, d111111abcdef8.cloudfront.net), you need to update your settings with your DNS service provider. For Amazon S3 CNAMEs to work, your DNS service provider must have a CNAME resource record set for your domain that currently routes queries for the domain to your Amazon S3 bucket. For example, if a user requests this object: https://example.com/images/image.jpg The request is automatically rerouted, and the user sees this object: https://amzn-s3-demo-bucket.s3.amazonaws.com/images/image.jpg To route queries to your CloudFront distribution instead of your Amazon S3 bucket, you need to use the method provided by your DNS service provider to update the CNAME resource record set for your domain. This updated CNAME record redirects DNS queries from your domain to the CloudFront domain name for your distribution. For more information, see the documentation provided by your DNS service provider. Note If you're using Route 53 as your DNS service, you can use either a CNAME resource record set or an alias resource record set. For information about editing resource record sets, see Editing records. For information about alias resource record sets, see Choosing between alias and non-alias records. Both topics are in the Amazon Route 53 Developer Guide. For more information about using CNAMEs with CloudFront, see the section called “Use custom URLs”. After you update the CNAME resource record set, it can take up to 72 hours for the change to propagate throughout the DNS system, although it usually happens faster. During this time, some requests for your content will continue to be routed to your Amazon S3 bucket, and others will be routed to CloudFront. Use an Amazon S3 bucket 120 Amazon CloudFront Developer Guide Move an Amazon S3 bucket to a different AWS Region If you're using Amazon S3 as the origin for a CloudFront distribution and you move the bucket to a different AWS Region, CloudFront can take up to an hour to update its records to use the new Region when both of the following are true: • You're using a CloudFront origin access identity (OAI) to restrict access to the bucket. • You move the bucket to an Amazon S3 Region that requires Signature Version 4 for authentication. When you're using OAIs, CloudFront uses the Region (among other values) to calculate the signature that it uses to request objects from your bucket. For more information about OAIs, see the section called “Use an origin access identity (legacy, not recommended)”. For a list of AWS Regions that support Signature Version 2, see Signature Version 2 signing process in the Amazon Web Services General Reference. To force a |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.