# GeoRestriction

Controls the countries in which content is distributed.

- Source: [`aws-cloudfront/lib/geo-restriction.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/aws-cloudfront/lib/geo-restriction.ts#L7)

## Example

```ts
// Adding restrictions to a Cloudfront Web Distribution.
declare const sourceBucket: s3.Bucket;
new cloudfront.CloudFrontWebDistribution(this, 'MyDistribution', {
  originConfigs: [
    {
      s3OriginSource: {
        s3BucketSource: sourceBucket,
      },
      behaviors : [ {isDefaultBehavior: true}],
    },
  ],
  geoRestriction: cloudfront.GeoRestriction.allowlist('US', 'GB'),
});
```

## Properties

- `locations`: string[] (required) — Two-letter, uppercase country code for a country that you want to allow/deny.

  Include one element for each country.
  See ISO 3166-1-alpha-2 code on the *International Organization for Standardization* website

- `restrictionType`: string (required) — Specifies the restriction type to impose.

## Methods

- `allowlist(...locations: string[]): GeoRestriction // chainable` (static) — Allow specific countries which you want CloudFront to distribute your content.

  **Parameters**

  - `locations` — Two-letter, uppercase country code for a country that you want to allow.

- `denylist(...locations: string[]): GeoRestriction // chainable` (static) — Deny specific countries which you don't want CloudFront to distribute your content.

  **Parameters**

  - `locations` — Two-letter, uppercase country code for a country that you want to deny.
