class CrossAccountDestination (construct)
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.Logs.CrossAccountDestination |
![]() | software.amazon.awscdk.services.logs.CrossAccountDestination |
![]() | aws_cdk.aws_logs.CrossAccountDestination |
![]() | @aws-cdk/aws-logs » CrossAccountDestination |
Implements
IConstruct
, IConstruct
, IDependable
, IResource
, ILog
A new CloudWatch Logs Destination for use in cross-account scenarios.
CrossAccountDestinations are used to subscribe a Kinesis stream in a different account to a CloudWatch Subscription.
Consumers will hardly ever need to use this class. Instead, directly
subscribe a Kinesis stream using the integration class in the
@aws-cdk/aws-logs-destinations
package; if necessary, a
CrossAccountDestination
will be created automatically.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as iam from '@aws-cdk/aws-iam';
import * as logs from '@aws-cdk/aws-logs';
declare const role: iam.Role;
const crossAccountDestination = new logs.CrossAccountDestination(this, 'MyCrossAccountDestination', {
role: role,
targetArn: 'targetArn',
// the properties below are optional
destinationName: 'destinationName',
});
Initializer
new CrossAccountDestination(scope: Construct, id: string, props: CrossAccountDestinationProps)
Parameters
- scope
Construct
- id
string
- props
Cross
Account Destination Props
Construct Props
Name | Type | Description |
---|---|---|
role | IRole | The role to assume that grants permissions to write to 'target'. |
target | string | The log destination target's ARN. |
destination | string | The name of the log destination. |
role
Type:
IRole
The role to assume that grants permissions to write to 'target'.
The role must be assumable by 'logs.{REGION}.amazonaws.com'.
targetArn
Type:
string
The log destination target's ARN.
destinationName?
Type:
string
(optional, default: Automatically generated)
The name of the log destination.
Properties
Name | Type | Description |
---|---|---|
destination | string | The ARN of this CrossAccountDestination object. |
destination | string | The name of this CrossAccountDestination object. |
env | Resource | The environment this resource belongs to. |
node | Construct | The construct tree node associated with this construct. |
policy | Policy | Policy object of this CrossAccountDestination object. |
stack | Stack | The stack in which this resource is defined. |
destinationArn
Type:
string
The ARN of this CrossAccountDestination object.
destinationName
Type:
string
The name of this CrossAccountDestination object.
env
Type:
Resource
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
node
Type:
Construct
The construct tree node associated with this construct.
policyDocument
Type:
Policy
Policy object of this CrossAccountDestination object.
stack
Type:
Stack
The stack in which this resource is defined.
Methods
Name | Description |
---|---|
add | |
apply | Apply the given removal policy to this resource. |
bind(_scope, _sourceLogGroup) | Return the properties required to send subscription events to this destination. |
to | Returns a string representation of this construct. |
addToPolicy(statement)
public addToPolicy(statement: PolicyStatement): void
Parameters
- statement
Policy
Statement
applyRemovalPolicy(policy)
public applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
Policy
Apply the given removal policy to this resource.
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
).
bind(_scope, _sourceLogGroup)
public bind(_scope: Construct, _sourceLogGroup: ILogGroup): LogSubscriptionDestinationConfig
Parameters
Returns
Return the properties required to send subscription events to this destination.
If necessary, the destination can use the properties of the SubscriptionFilter object itself to configure its permissions to allow the subscription to write to it.
The destination may reconfigure its own permissions in response to this function call.
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.