AWS::AppConfig::HostedConfigurationVersion - AWS CloudFormation (original) (raw)

Create a new configuration in the AWS AppConfig hosted configuration store. Configurations must be 1 MB or smaller. The AWS AppConfig hosted configuration store provides the following benefits over other configuration store options.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

{
  "Type" : "AWS::AppConfig::HostedConfigurationVersion",
  "Properties" : {
      "ApplicationId" : String,
      "ConfigurationProfileId" : String,
      "Content" : String,
      "ContentType" : String,
      "Description" : String,
      "LatestVersionNumber" : Integer,
      "VersionLabel" : String
    }
}

YAML

Type: AWS::AppConfig::HostedConfigurationVersion
Properties:
  ApplicationId: String
  ConfigurationProfileId: String
  Content: String
  ContentType: String
  Description: String
  LatestVersionNumber: Integer
  VersionLabel: String

Properties

ApplicationId

The application ID.

Required: Yes

Type: String

Pattern: [a-z0-9]{4,7}

Update requires: Replacement

ConfigurationProfileId

The configuration profile ID.

Required: Yes

Type: String

Pattern: [a-z0-9]{4,7}

Update requires: Replacement

Content

The configuration data, as bytes.

Note

AWS AppConfig accepts any type of data, including text formats like JSON or TOML, or binary formats like protocol buffers or compressed data.

Required: Yes

Type: String

Update requires: Replacement

ContentType

A standard MIME type describing the format of the configuration content. For more information, see Content-Type.

Required: Yes

Type: String

Minimum: 1

Maximum: 255

Update requires: Replacement

Description

A description of the configuration.

Note

Due to HTTP limitations, this field only supports ASCII characters.

Required: No

Type: String

Minimum: 0

Maximum: 1024

Update requires: Replacement

LatestVersionNumber

An optional locking token used to prevent race conditions from overwriting configuration updates when creating a new version. To ensure your data is not overwritten when creating multiple hosted configuration versions in rapid succession, specify the version number of the latest hosted configuration version.

Required: No

Type: Integer

Update requires: Replacement

VersionLabel

A user-defined label for an AWS AppConfig hosted configuration version.

Required: No

Type: String

Pattern: ^$|.*[^0-9].*

Minimum: 0

Maximum: 64

Update requires: Replacement

Return values

Ref

When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the version number.

Fn::GetAtt

VersionNumber

The configuration version.

Examples

AWS AppConfig feature flag

The following example creates an AWS AppConfig configuration profile of typeHostedConfigurationVersion. The feature flag created by this example enables cryptocurrency at checkout. AWS AppConfig stores the configuration data for this profile in the AWS AppConfig hosted configuration store.

JSON

{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Transform": "AWS::LanguageExtensions",
  "Resources": {
    "MySuperCoolApp": {
      "Type": "AWS::AppConfig::Application",
      "Properties": {
        "Name": "MySuperCoolApp"
      }
    },
    "MyFeatureFlags": {
      "Type": "AWS::AppConfig::ConfigurationProfile",
      "Properties": {
        "Name": "MyFeatureFlags",
        "ApplicationId": "MySuperCoolApp",
        "LocationUri": "hosted",
        "Type": "AWS.AppConfig.FeatureFlags"
      }
    },
    "MyFeatureFlagsVersion": {
      "Type": "AWS::AppConfig::HostedConfigurationVersion",
      "Properties": {
        "ApplicationId": "MySuperCoolApp",
        "ConfigurationProfileId": "MyFeatureFlags",
        "ContentType": "application/json",
        "VersionLabel": "v1.0.0",
        "Content": {
          "Fn::ToJsonString": {
            "flags": {
              "allow-cryptocurrency-at-checkout": {
                "attributes": {
                  "allowed-currency": {
                    "constraints": {
                      "elements": {
                        "enum": [
                          "BTC",
                          "ETH",
                          "XRP"
                        ],
                        "type": "string"
                      },
                      "type": "array"
                    }
                  },
                  "bitcoin-discount-percentage": {
                    "constraints": {
                      "maximum": 25,
                      "minimum": 0,
                      "type": "number"
                    }
                  }
                },
                "name": "Allow Cryptocurrency at Checkout"
              }
            },
            "values": {
              "allow-cryptocurrency-at-checkout": {
                "allowed-currency": [
                  "BTC",
                  "ETH"
                ],
                "bitcoin-discount-percentage": 5,
                "enabled": true
              }
            },
            "version": "1"
          }
        }
      }
    }
  }
}

YAML

AWSTemplateFormatVersion: 2010-09-09
Transform: 'AWS::LanguageExtensions'
Resources:
  MySuperCoolApp:
    Type: 'AWS::AppConfig::Application'
    Properties:
      Name: MySuperCoolApp

  MyFeatureFlags:
    Type: 'AWS::AppConfig::ConfigurationProfile'
    Properties:
      Name: MyFeatureFlags
      ApplicationId: !Ref MySuperCoolApp
      LocationUri: hosted
      Type: AWS.AppConfig.FeatureFlags

  MyFeatureFlagsVersion:
    Type: 'AWS::AppConfig::HostedConfigurationVersion'
    Properties:
      ApplicationId: !Ref MySuperCoolApp
      ConfigurationProfileId: !Ref MyFeatureFlags
      ContentType: application/json
      VersionLabel: "v1.0.0"
      Content: 
        Fn::ToJsonString:
            flags:
              allow-cryptocurrency-at-checkout:
                attributes:
                  allowed-currency:
                    constraints:
                      elements:
                        enum:
                          - BTC
                          - ETH
                          - XRP
                        type: string
                      type: array
                  bitcoin-discount-percentage:
                    constraints:
                      maximum: 25
                      minimum: 0
                      type: number
                name: Allow Cryptocurrency at Checkout
            values:
              allow-cryptocurrency-at-checkout:
                allowed-currency:
                  - BTC
                  - ETH
                bitcoin-discount-percentage: 5
                enabled: true
            version: '1'

AWS AppConfig hosted configuration

The following example creates an AWS AppConfig configuration profile namedMyTestProfile for an application called MyApplication. AWS AppConfig stores the configuration data for this profile in the AWS AppConfig hosted configuration store.

JSON

{
  "Resources": {
    "DependentApplication": {
      "Type": "AWS::AppConfig::Application",
      "Properties": {
        "Name": "MyApplication"
      }
    },
    "DependentConfigurationProfile": {
      "Type": "AWS::AppConfig::ConfigurationProfile",
      "Properties": {
        "ApplicationId": "DependentApplication",
        "Name": "MyTestProfile",
        "LocationUri": "hosted"
      }
    },
    "BasicHostedConfigurationVersion": {
      "Type": "AWS::AppConfig::HostedConfigurationVersion",
      "Properties": {
        "ApplicationId": "DependentApplication",
        "ConfigurationProfileId": "DependentConfigurationProfile",
        "Description": "A sample hosted configuration version",
        "Content": "My hosted configuration content",
        "ContentType": "text/plain"
      }
    }
  }
}

YAML

Resources:
  DependentApplication:
    Type: AWS::AppConfig::Application
    Properties:
      Name: "MyApplication"
  DependentConfigurationProfile:
    Type: AWS::AppConfig::ConfigurationProfile
    Properties:
      ApplicationId: !Ref DependentApplication
      Name: "MyTestProfile"
      LocationUri: "hosted"
  BasicHostedConfigurationVersion:
    Type: AWS::AppConfig::HostedConfigurationVersion
    Properties:
      ApplicationId: !Ref DependentApplication
      ConfigurationProfileId: !Ref DependentConfigurationProfile
      Description: 'A sample hosted configuration version'
      Content: 'My hosted configuration content'
      ContentType: 'text/plain'

See also