Environment L2 construct
An AWS AppConfig environment.
[disable-awslint:no-grants]
Example
const app = new appconfig.Application(this, 'MyApp');
const env = new appconfig.Environment(this, 'MyEnv', {
application: app,
});
new appconfig.HostedConfiguration(this, 'MyFirstHostedConfig', {
application: app,
deployTo: [env],
content: appconfig.ConfigurationContent.fromInlineText('This is my first configuration content.'),
});
new appconfig.HostedConfiguration(this, 'MySecondHostedConfig', {
application: app,
deployTo: [env],
content: appconfig.ConfigurationContent.fromInlineText('This is my second configuration content.'),
});
app = appconfig.Application(self, "MyApp")
env = appconfig.Environment(self, "MyEnv",
application=app
)
appconfig.HostedConfiguration(self, "MyFirstHostedConfig",
application=app,
deploy_to=[env],
content=appconfig.ConfigurationContent.from_inline_text("This is my first configuration content.")
)
appconfig.HostedConfiguration(self, "MySecondHostedConfig",
application=app,
deploy_to=[env],
content=appconfig.ConfigurationContent.from_inline_text("This is my second configuration content.")
)
Application app = new Application(this, "MyApp");
Environment env = Environment.Builder.create(this, "MyEnv")
.application(app)
.build();
HostedConfiguration.Builder.create(this, "MyFirstHostedConfig")
.application(app)
.deployTo(List.of(env))
.content(ConfigurationContent.fromInlineText("This is my first configuration content."))
.build();
HostedConfiguration.Builder.create(this, "MySecondHostedConfig")
.application(app)
.deployTo(List.of(env))
.content(ConfigurationContent.fromInlineText("This is my second configuration content."))
.build();
// Install: dotnet add package Amazon.CDK.Lib
var app = new Application(this, "MyApp");
var env = new Environment(this, "MyEnv", new EnvironmentProps {
Application = app
});
new HostedConfiguration(this, "MyFirstHostedConfig", new HostedConfigurationProps {
Application = app,
DeployTo = new [] { env },
Content = ConfigurationContent.FromInlineText("This is my first configuration content.")
});
new HostedConfiguration(this, "MySecondHostedConfig", new HostedConfigurationProps {
Application = app,
DeployTo = new [] { env },
Content = ConfigurationContent.FromInlineText("This is my second configuration content.")
});
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
app := appconfig.NewApplication(this, jsii.String("MyApp"))
env := appconfig.NewEnvironment(this, jsii.String("MyEnv"), &EnvironmentProps{
Application: app,
})
appconfig.NewHostedConfiguration(this, jsii.String("MyFirstHostedConfig"), &HostedConfigurationProps{
Application: app,
DeployTo: []IEnvironment{
env,
},
Content: appconfig.ConfigurationContent_FromInlineText(jsii.String("This is my first configuration content.")),
})
appconfig.NewHostedConfiguration(this, jsii.String("MySecondHostedConfig"), &HostedConfigurationProps{
Application: app,
DeployTo: []IEnvironment{
env,
},
Content: appconfig.ConfigurationContent_*FromInlineText(jsii.String("This is my second configuration content.")),
})
Initializer
new Environment(scope: Construct, id: string, props: EnvironmentProps)
Environment(scope: Construct, id: str, props: EnvironmentProps)
new Environment(Construct scope, String id, EnvironmentProps props)
new Environment(Construct scope, string id, EnvironmentProps props)
NewEnvironment(Scope Construct, Id *string, Props EnvironmentProps)
Construct Props
applicationIApplicationapplicationIApplicationapplicationIApplicationApplicationIApplicationApplicationIApplicationrequired#deletionProtectionCheckDeletionProtectionCheckdeletion_protection_checkDeletionProtectionCheckdeletionProtectionCheckDeletionProtectionCheckDeletionProtectionCheckDeletionProtectionCheckDeletionProtectionCheckDeletionProtectionCheck= undefined - AppConfig default is…#default
Default: undefined - AppConfig default is ACCOUNT_DEFAULT
descriptionstringdescriptionstrdescriptionStringDescriptionstringDescription*string= No description.#environmentNamestringenvironment_namestrenvironmentNameStringEnvironmentNamestringEnvironmentName*string= A name is generated.#Properties
applicationIApplicationapplicationIApplicationapplicationIApplicationApplicationIApplicationApplicationIApplication#applicationIdstringapplication_idstrapplicationIdStringApplicationIdstringApplicationId*stringrequired#envResourceEnvironmentenvResourceEnvironmentenvResourceEnvironmentEnvResourceEnvironmentEnvResourceEnvironmentrequired#notes
For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.
For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.
environmentArnstringenvironment_arnstrenvironmentArnStringEnvironmentArnstringEnvironmentArn*stringrequired#environmentIdstringenvironment_idstrenvironmentIdStringEnvironmentIdstringEnvironmentId*stringrequired#environmentRefEnvironmentReferenceenvironment_refEnvironmentReferenceenvironmentRefEnvironmentReferenceEnvironmentRefEnvironmentReferenceEnvironmentRefEnvironmentReferencerequired#monitorsMonitor[]monitorstyping.List[Monitor]monitorsList<Monitor>MonitorsMonitor[]Monitors*[]Monitor#PROPERTY_INJECTION_IDstringproperty_injection_idstrPROPERTY_INJECTION_IDStringPROPERTY_INJECTION_IDstringPROPERTY_INJECTION_ID*stringrequiredstatic#Methods
addDeployment(configuration: IConfiguration): voiddef add_deployment(self, configuration: IConfiguration) -> Nonepublic void addDeployment(IConfiguration configuration)public void AddDeployment(IConfiguration configuration)func AddDeployment(Configuration IConfiguration)#notes
Note that you can only deploy one configuration at a time to an environment. However, you can deploy one configuration each to different environments at the same time. If more than one deployment is requested for this environment, they will occur in the same order they were provided.
addDeployments(...configurations: IConfiguration[]): voiddef add_deployments(self, configurations: IConfiguration) -> Nonepublic void addDeployments(IConfiguration configurations)public void AddDeployments(IConfiguration configurations)func AddDeployments(Configurations IConfiguration)#These configurations will be deployed in the same order as the input array.
addExtension(extension: IExtension): voiddef add_extension(self, extension: IExtension) -> Nonepublic void addExtension(IExtension extension)public void AddExtension(IExtension extension)func AddExtension(Extension IExtension)#applyCrossStackReferenceStrength(strength: ReferenceStrength): voiddef apply_cross_stack_reference_strength(self, strength: ReferenceStrength) -> Nonepublic void applyCrossStackReferenceStrength(ReferenceStrength strength)public void ApplyCrossStackReferenceStrength(ReferenceStrength strength)func ApplyCrossStackReferenceStrength(Strength ReferenceStrength)#notes · 1 parameter
When set, any cross-stack reference to this resource will use the specified mechanism instead of the global default determined by the @aws-cdk/core:defaultCrossStackReferences context key. This is useful for selectively weakening specific references to avoid the "deadly embrace" problem without changing the app-wide default.
Parameters
strengthstrengthstrengthstrengthStrength— - The reference strength to use for this resource.
applyRemovalPolicy(policy: RemovalPolicy): voiddef apply_removal_policy(self, policy: RemovalPolicy) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy)public void ApplyRemovalPolicy(RemovalPolicy policy)func ApplyRemovalPolicy(Policy RemovalPolicy)#notes
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).
atDeploymentTick(eventDestination: IEventDestination, options?: ExtensionOptions): voiddef at_deployment_tick(self, event_destination: IEventDestination, options: typing.Optional[ExtensionOptions] = None) -> Nonepublic void atDeploymentTick(IEventDestination eventDestination, ExtensionOptions options)public void AtDeploymentTick(IEventDestination eventDestination, ExtensionOptions? options = null)func AtDeploymentTick(EventDestination IEventDestination, Options ExtensionOptions)#fromEnvironmentArn(scope: Construct, id: string, environmentArn: string): IEnvironment@staticmethod def from_environment_arn(scope: Construct, id: str, environment_arn: str) -> IEnvironmentpublic static IEnvironment fromEnvironmentArn(Construct scope, String id, String environmentArn)public static IEnvironment FromEnvironmentArn(Construct scope, string id, string environmentArn)func FromEnvironmentArn(Scope Construct, Id *string, EnvironmentArn *string) IEnvironmentstatic#3 parameters
Parameters
scopescopescopescopeScope— The parent construct.ididididId— The name of the environment construct.environmentArnenvironment_arnenvironmentArnenvironmentArnEnvironmentArn— The Amazon Resource Name (ARN) of the environment.
fromEnvironmentAttributes(scope: Construct, id: string, attrs: EnvironmentAttributes): IEnvironment@staticmethod def from_environment_attributes(scope: Construct, id: str, attrs: EnvironmentAttributes) -> IEnvironmentpublic static IEnvironment fromEnvironmentAttributes(Construct scope, String id, EnvironmentAttributes attrs)public static IEnvironment FromEnvironmentAttributes(Construct scope, string id, EnvironmentAttributes attrs)func FromEnvironmentAttributes(Scope Construct, Id *string, Attrs EnvironmentAttributes) IEnvironmentstatic#3 parameters
Parameters
scopescopescopescopeScope— The parent construct.ididididId— The name of the environment construct.attrsattrsattrsattrsAttrs— The attributes of the environment.
grant(grantee: IGrantable, ...actions: string[]): Grantdef grant(self, grantee: IGrantable, actions: str) -> Grantpublic Grant grant(IGrantable grantee, String actions)public Grant Grant(IGrantable grantee, string actions)func Grant(Grantee IGrantable, Actions *string) Grant#grantReadConfig(identity: IGrantable): Grantdef grant_read_config(self, identity: IGrantable) -> Grantpublic Grant grantReadConfig(IGrantable identity)public Grant GrantReadConfig(IGrantable identity)func GrantReadConfig(Identity IGrantable) Grant#isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#notes · 1 parameter · returns
Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.
Parameters
xxxxX— Any object.
Returns: true if x is an object created from a class which extends Construct.
isOwnedResource(construct: IConstruct): boolean@staticmethod def is_owned_resource(construct: IConstruct) -> boolpublic static Boolean isOwnedResource(IConstruct construct)public static bool IsOwnedResource(IConstruct construct)func IsOwnedResource(Construct IConstruct) *boolstatic#isResource(construct: IConstruct): boolean@staticmethod def is_resource(construct: IConstruct) -> boolpublic static Boolean isResource(IConstruct construct)public static bool IsResource(IConstruct construct)func IsResource(Construct IConstruct) *boolstatic#on(actionPoint: ActionPoint, eventDestination: IEventDestination, options?: ExtensionOptions): voiddef on(self, action_point: ActionPoint, event_destination: IEventDestination, options: typing.Optional[ExtensionOptions] = None) -> Nonepublic void on(ActionPoint actionPoint, IEventDestination eventDestination, ExtensionOptions options)public void On(ActionPoint actionPoint, IEventDestination eventDestination, ExtensionOptions? options = null)func On(ActionPoint ActionPoint, EventDestination IEventDestination, Options ExtensionOptions)#onDeploymentBaking(eventDestination: IEventDestination, options?: ExtensionOptions): voiddef on_deployment_baking(self, event_destination: IEventDestination, options: typing.Optional[ExtensionOptions] = None) -> Nonepublic void onDeploymentBaking(IEventDestination eventDestination, ExtensionOptions options)public void OnDeploymentBaking(IEventDestination eventDestination, ExtensionOptions? options = null)func OnDeploymentBaking(EventDestination IEventDestination, Options ExtensionOptions)#onDeploymentComplete(eventDestination: IEventDestination, options?: ExtensionOptions): voiddef on_deployment_complete(self, event_destination: IEventDestination, options: typing.Optional[ExtensionOptions] = None) -> Nonepublic void onDeploymentComplete(IEventDestination eventDestination, ExtensionOptions options)public void OnDeploymentComplete(IEventDestination eventDestination, ExtensionOptions? options = null)func OnDeploymentComplete(EventDestination IEventDestination, Options ExtensionOptions)#onDeploymentRolledBack(eventDestination: IEventDestination, options?: ExtensionOptions): voiddef on_deployment_rolled_back(self, event_destination: IEventDestination, options: typing.Optional[ExtensionOptions] = None) -> Nonepublic void onDeploymentRolledBack(IEventDestination eventDestination, ExtensionOptions options)public void OnDeploymentRolledBack(IEventDestination eventDestination, ExtensionOptions? options = null)func OnDeploymentRolledBack(EventDestination IEventDestination, Options ExtensionOptions)#onDeploymentStart(eventDestination: IEventDestination, options?: ExtensionOptions): voiddef on_deployment_start(self, event_destination: IEventDestination, options: typing.Optional[ExtensionOptions] = None) -> Nonepublic void onDeploymentStart(IEventDestination eventDestination, ExtensionOptions options)public void OnDeploymentStart(IEventDestination eventDestination, ExtensionOptions? options = null)func OnDeploymentStart(EventDestination IEventDestination, Options ExtensionOptions)#onDeploymentStep(eventDestination: IEventDestination, options?: ExtensionOptions): voiddef on_deployment_step(self, event_destination: IEventDestination, options: typing.Optional[ExtensionOptions] = None) -> Nonepublic void onDeploymentStep(IEventDestination eventDestination, ExtensionOptions options)public void OnDeploymentStep(IEventDestination eventDestination, ExtensionOptions? options = null)func OnDeploymentStep(EventDestination IEventDestination, Options ExtensionOptions)#preCreateHostedConfigurationVersion(eventDestination: IEventDestination, options?: ExtensionOptions): voiddef pre_create_hosted_configuration_version(self, event_destination: IEventDestination, options: typing.Optional[ExtensionOptions] = None) -> Nonepublic void preCreateHostedConfigurationVersion(IEventDestination eventDestination, ExtensionOptions options)public void PreCreateHostedConfigurationVersion(IEventDestination eventDestination, ExtensionOptions? options = null)func PreCreateHostedConfigurationVersion(EventDestination IEventDestination, Options ExtensionOptions)#preStartDeployment(eventDestination: IEventDestination, options?: ExtensionOptions): voiddef pre_start_deployment(self, event_destination: IEventDestination, options: typing.Optional[ExtensionOptions] = None) -> Nonepublic void preStartDeployment(IEventDestination eventDestination, ExtensionOptions options)public void PreStartDeployment(IEventDestination eventDestination, ExtensionOptions? options = null)func PreStartDeployment(EventDestination IEventDestination, Options ExtensionOptions)#toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.