Skip to content
v2.274.0

Experimental

@aws-cdk/aws-iot-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

ScheduledAudit L2 construct ​

Defines AWS IoT Scheduled Audit.

Example ​

ts
declare const config: iot.AccountAuditConfiguration;

// Daily audit
const dailyAudit = new iot.ScheduledAudit(this, 'DailyAudit', {
  accountAuditConfiguration: config,
  frequency: iot.Frequency.DAILY,
  auditChecks: [
    iot.AuditCheck.AUTHENTICATED_COGNITO_ROLE_OVERLY_PERMISSIVE_CHECK,
  ],
})

// Weekly audit
const weeklyAudit = new iot.ScheduledAudit(this, 'WeeklyAudit', {
  accountAuditConfiguration: config,
  frequency: iot.Frequency.WEEKLY,
  dayOfWeek: iot.DayOfWeek.SUNDAY,
  auditChecks: [
    iot.AuditCheck.CA_CERTIFICATE_EXPIRING_CHECK,
  ],
});

// Monthly audit
const monthlyAudit = new iot.ScheduledAudit(this, 'MonthlyAudit', {
  accountAuditConfiguration: config,
  frequency: iot.Frequency.MONTHLY,
  dayOfMonth: iot.DayOfMonth.of(1),
  auditChecks: [
    iot.AuditCheck.CA_CERTIFICATE_KEY_QUALITY_CHECK,
  ],
});
python
# config: iot.AccountAuditConfiguration


# Daily audit
daily_audit = iot.ScheduledAudit(self, "DailyAudit",
    account_audit_configuration=config,
    frequency=iot.Frequency.DAILY,
    audit_checks=[iot.AuditCheck.AUTHENTICATED_COGNITO_ROLE_OVERLY_PERMISSIVE_CHECK
    ]
)

# Weekly audit
weekly_audit = iot.ScheduledAudit(self, "WeeklyAudit",
    account_audit_configuration=config,
    frequency=iot.Frequency.WEEKLY,
    day_of_week=iot.DayOfWeek.SUNDAY,
    audit_checks=[iot.AuditCheck.CA_CERTIFICATE_EXPIRING_CHECK
    ]
)

# Monthly audit
monthly_audit = iot.ScheduledAudit(self, "MonthlyAudit",
    account_audit_configuration=config,
    frequency=iot.Frequency.MONTHLY,
    day_of_month=iot.DayOfMonth.of(1),
    audit_checks=[iot.AuditCheck.CA_CERTIFICATE_KEY_QUALITY_CHECK
    ]
)
java
AccountAuditConfiguration config;


// Daily audit
ScheduledAudit dailyAudit = ScheduledAudit.Builder.create(this, "DailyAudit")
        .accountAuditConfiguration(config)
        .frequency(Frequency.DAILY)
        .auditChecks(List.of(AuditCheck.AUTHENTICATED_COGNITO_ROLE_OVERLY_PERMISSIVE_CHECK))
        .build();

// Weekly audit
ScheduledAudit weeklyAudit = ScheduledAudit.Builder.create(this, "WeeklyAudit")
        .accountAuditConfiguration(config)
        .frequency(Frequency.WEEKLY)
        .dayOfWeek(DayOfWeek.SUNDAY)
        .auditChecks(List.of(AuditCheck.CA_CERTIFICATE_EXPIRING_CHECK))
        .build();

// Monthly audit
ScheduledAudit monthlyAudit = ScheduledAudit.Builder.create(this, "MonthlyAudit")
        .accountAuditConfiguration(config)
        .frequency(Frequency.MONTHLY)
        .dayOfMonth(DayOfMonth.of(1))
        .auditChecks(List.of(AuditCheck.CA_CERTIFICATE_KEY_QUALITY_CHECK))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.AWS.IoT.Alpha
AccountAuditConfiguration config;


// Daily audit
var dailyAudit = new ScheduledAudit(this, "DailyAudit", new ScheduledAuditProps {
    AccountAuditConfiguration = config,
    Frequency = Frequency.DAILY,
    AuditChecks = new [] { AuditCheck.AUTHENTICATED_COGNITO_ROLE_OVERLY_PERMISSIVE_CHECK }
});

// Weekly audit
var weeklyAudit = new ScheduledAudit(this, "WeeklyAudit", new ScheduledAuditProps {
    AccountAuditConfiguration = config,
    Frequency = Frequency.WEEKLY,
    DayOfWeek = DayOfWeek.SUNDAY,
    AuditChecks = new [] { AuditCheck.CA_CERTIFICATE_EXPIRING_CHECK }
});

// Monthly audit
var monthlyAudit = new ScheduledAudit(this, "MonthlyAudit", new ScheduledAuditProps {
    AccountAuditConfiguration = config,
    Frequency = Frequency.MONTHLY,
    DayOfMonth = DayOfMonth.Of(1),
    AuditChecks = new [] { AuditCheck.CA_CERTIFICATE_KEY_QUALITY_CHECK }
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdkiotalpha/v2
var config AccountAuditConfiguration


// Daily audit
dailyAudit := iot.NewScheduledAudit(this, jsii.String("DailyAudit"), &ScheduledAuditProps{
	AccountAuditConfiguration: config,
	Frequency: iot.Frequency_DAILY,
	AuditChecks: []AuditCheck{
		iot.AuditCheck_AUTHENTICATED_COGNITO_ROLE_OVERLY_PERMISSIVE_CHECK,
	},
})

// Weekly audit
weeklyAudit := iot.NewScheduledAudit(this, jsii.String("WeeklyAudit"), &ScheduledAuditProps{
	AccountAuditConfiguration: config,
	Frequency: iot.Frequency_WEEKLY,
	DayOfWeek: iot.DayOfWeek_SUNDAY,
	AuditChecks: []AuditCheck{
		iot.AuditCheck_CA_CERTIFICATE_EXPIRING_CHECK,
	},
})

// Monthly audit
monthlyAudit := iot.NewScheduledAudit(this, jsii.String("MonthlyAudit"), &ScheduledAuditProps{
	AccountAuditConfiguration: config,
	Frequency: iot.Frequency_MONTHLY,
	DayOfMonth: iot.DayOfMonth_Of(jsii.Number(1)),
	AuditChecks: []AuditCheck{
		iot.AuditCheck_CA_CERTIFICATE_KEY_QUALITY_CHECK,
	},
})

Initializer ​

ts
new ScheduledAudit(scope: Construct, id: string, props: ScheduledAuditProps)
python
ScheduledAudit(scope: Construct, id: str, props: ScheduledAuditProps)
java
new ScheduledAudit(Construct scope, String id, ScheduledAuditProps props)
csharp
new ScheduledAudit(Construct scope, string id, ScheduledAuditProps props)
go
NewScheduledAudit(Scope Construct, Id *string, Props ScheduledAuditProps)

Construct Props ​

accountAuditConfigurationIAccountAuditConfigurationaccount_audit_configurationIAccountAuditConfigurationaccountAuditConfigurationIAccountAuditConfigurationAccountAuditConfigurationIAccountAuditConfigurationAccountAuditConfigurationIAccountAuditConfigurationrequired#
Account audit configuration.

The audit checks specified in auditChecks must be enabled in this configuration.

auditChecksAuditCheck[]audit_checkstyping.List[AuditCheck]auditChecksList<AuditCheck>AuditChecksAuditCheck[]AuditChecks*[]AuditCheckrequired#
Which checks are performed during the scheduled audit.

Checks must be enabled for your account.

dayOfMonthDayOfMonthday_of_monthDayOfMonthdayOfMonthDayOfMonthDayOfMonthDayOfMonthDayOfMonthDayOfMonth#
The day of the month on which the scheduled audit is run (if the frequency is "MONTHLY").

Default: required if frequency is "MONTHLY", not allowed otherwise

If days 29-31 are specified, and the month does not have that many days, the audit takes place on the "LAST" day of the month.

dayOfWeekDayOfWeekday_of_weekDayOfWeekdayOfWeekDayOfWeekDayOfWeekDayOfWeekDayOfWeekDayOfWeek#
The day of the week on which the scheduled audit is run (if the frequency is "WEEKLY" or "BIWEEKLY").

Default: required if frequency is "WEEKLY" or "BIWEEKLY", not allowed otherwise

frequencyFrequencyfrequencyFrequencyfrequencyFrequencyFrequencyFrequencyFrequencyFrequencyrequired#
How often the scheduled audit occurs.
scheduledAuditNamestringscheduled_audit_namestrscheduledAuditNameStringScheduledAuditNamestringScheduledAuditName*string#
The name of the scheduled audit.

Default: auto generated name

Properties ​

The environment this resource belongs to.
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.

nodeNodenodeNodenodeNodeNodeNodeNodeNoderequired#
The tree node.
PROPERTY_INJECTION_IDstringproperty_injection_idstrPROPERTY_INJECTION_IDStringPROPERTY_INJECTION_IDstringPROPERTY_INJECTION_ID*stringrequiredstatic#
Uniquely identifies this class.
scheduledAuditArnstringscheduled_audit_arnstrscheduledAuditArnStringScheduledAuditArnstringScheduledAuditArn*stringrequired#
The ARN of the scheduled audit.
scheduledAuditNamestringscheduled_audit_namestrscheduledAuditNameStringScheduledAuditNamestringScheduledAuditName*stringrequired#
The scheduled audit name.
stackStackstackStackstackStackStackStackStackStackrequired#
The stack in which this resource is defined.

Methods ​

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)#
Override the cross-stack reference strength for this resource.
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)#
Apply the given removal policy to this resource.
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).

fromScheduledAuditArn(scope: Construct, id: string, scheduledAuditArn: string): IScheduledAudit@staticmethod def from_scheduled_audit_arn(scope: Construct, id: str, scheduled_audit_arn: str) -> IScheduledAuditpublic static IScheduledAudit fromScheduledAuditArn(Construct scope, String id, String scheduledAuditArn)public static IScheduledAudit FromScheduledAuditArn(Construct scope, string id, string scheduledAuditArn)func FromScheduledAuditArn(Scope Construct, Id *string, ScheduledAuditArn *string) IScheduledAuditstatic#
Import an existing AWS IoT Scheduled Audit from its ARN.
3 parameters

Parameters

  • scopescopescopescopeScope — The parent creating construct (usually this).
  • ididididId — The construct's name.
  • scheduledAuditArnscheduled_audit_arnscheduledAuditArnscheduledAuditArnScheduledAuditArn — The ARN of the scheduled audit.
fromScheduledAuditAttributes(scope: Construct, id: string, attrs: ScheduledAuditAttributes): IScheduledAudit@staticmethod def from_scheduled_audit_attributes(scope: Construct, id: str, attrs: ScheduledAuditAttributes) -> IScheduledAuditpublic static IScheduledAudit fromScheduledAuditAttributes(Construct scope, String id, ScheduledAuditAttributes attrs)public static IScheduledAudit FromScheduledAuditAttributes(Construct scope, string id, ScheduledAuditAttributes attrs)func FromScheduledAuditAttributes(Scope Construct, Id *string, Attrs ScheduledAuditAttributes) IScheduledAuditstatic#
Import an existing AWS IoT Scheduled Audit from its attributes.
3 parameters

Parameters

  • scopescopescopescopeScope — The parent creating construct (usually this).
  • ididididId — The construct's name.
  • attrsattrsattrsattrsAttrs — The scheduled audit attributes.
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#
Checks if `x` is a construct.
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#
Returns true if the construct was created by CDK, and false otherwise.
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#
Check whether the given construct is a Resource.
toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#
Returns a string representation of this construct.
with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#
Applies one or more mixins to this construct.

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.