Show / Hide Table of Contents

Class Environment

The deployment environment for a stack.

Inheritance
object
Environment
Implements
IEnvironment
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: Amazon.CDK
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class Environment : IEnvironment
Syntax (vb)
Public Class Environment Implements IEnvironment
Remarks

ExampleMetadata: infused

Examples
var stack1 = new Stack(app, "Stack1", new StackProps {
                Env = new Environment {
                    Region = "us-east-1"
                }
            });
            var cert = new Certificate(stack1, "Cert", new CertificateProps {
                DomainName = "*.example.com",
                Validation = CertificateValidation.FromDns(PublicHostedZone.FromHostedZoneId(stack1, "Zone", "Z0329774B51CGXTDQV3X"))
            });

            var stack2 = new Stack(app, "Stack2", new StackProps {
                Env = new Environment {
                    Region = "us-east-2"
                }
            });
            new Distribution(stack2, "Distribution", new DistributionProps {
                DefaultBehavior = new BehaviorOptions {
                    Origin = new HttpOrigin("example.com")
                },
                DomainNames = new [] { "dev.example.com" },
                Certificate = cert
            });

Synopsis

Constructors

Environment()

The deployment environment for a stack.

Properties

Account

The AWS account ID for this environment.

Region

The AWS region for this environment.

Constructors

Environment()

The deployment environment for a stack.

public Environment()
Remarks

ExampleMetadata: infused

Examples
var stack1 = new Stack(app, "Stack1", new StackProps {
                Env = new Environment {
                    Region = "us-east-1"
                }
            });
            var cert = new Certificate(stack1, "Cert", new CertificateProps {
                DomainName = "*.example.com",
                Validation = CertificateValidation.FromDns(PublicHostedZone.FromHostedZoneId(stack1, "Zone", "Z0329774B51CGXTDQV3X"))
            });

            var stack2 = new Stack(app, "Stack2", new StackProps {
                Env = new Environment {
                    Region = "us-east-2"
                }
            });
            new Distribution(stack2, "Distribution", new DistributionProps {
                DefaultBehavior = new BehaviorOptions {
                    Origin = new HttpOrigin("example.com")
                },
                DomainNames = new [] { "dev.example.com" },
                Certificate = cert
            });

Properties

Account

The AWS account ID for this environment.

public string? Account { get; set; }
Property Value

string

Remarks

This can be either a concrete value such as 585191031104 or Aws.ACCOUNT_ID which indicates that account ID will only be determined during deployment (it will resolve to the CloudFormation intrinsic {"Ref":"AWS::AccountId"}). Note that certain features, such as cross-stack references and environmental context providers require concrete region information and will cause this stack to emit synthesis errors.

Default: Aws.ACCOUNT_ID which means that the stack will be account-agnostic.

Region

The AWS region for this environment.

public string? Region { get; set; }
Property Value

string

Remarks

This can be either a concrete value such as eu-west-2 or Aws.REGION which indicates that account ID will only be determined during deployment (it will resolve to the CloudFormation intrinsic {"Ref":"AWS::Region"}). Note that certain features, such as cross-stack references and environmental context providers require concrete region information and will cause this stack to emit synthesis errors.

Default: Aws.REGION which means that the stack will be region-agnostic.

Implements

IEnvironment
Back to top Generated by DocFX