Enum Tenancy
- All Implemented Interfaces:
Serializable,Comparable<Tenancy>,java.lang.constant.Constable
@Generated(value="jsii-pacmak/1.119.0 (build 1634eac)",
date="2025-11-13T16:10:18.398Z")
@Stability(Experimental)
public enum Tenancy
extends Enum<Tenancy>
(experimental) The tenancy to use for an instance.
Example:
InfrastructureConfiguration infrastructureConfiguration = InfrastructureConfiguration.Builder.create(this, "InfrastructureConfiguration")
.infrastructureConfigurationName("test-infrastructure-configuration")
.description("An Infrastructure Configuration")
// Optional - instance types to use for build/test
.instanceTypes(List.of(InstanceType.of(InstanceClass.STANDARD7_INTEL, InstanceSize.LARGE), InstanceType.of(InstanceClass.BURSTABLE3, InstanceSize.LARGE)))
// Optional - create an instance profile with necessary permissions
.instanceProfile(InstanceProfile.Builder.create(this, "InstanceProfile")
.instanceProfileName("test-instance-profile")
.role(Role.Builder.create(this, "InstanceProfileRole")
.assumedBy(ServicePrincipal.fromStaticServicePrincipleName("ec2.amazonaws.com"))
.managedPolicies(List.of(ManagedPolicy.fromAwsManagedPolicyName("AmazonSSMManagedInstanceCore"), ManagedPolicy.fromAwsManagedPolicyName("EC2InstanceProfileForImageBuilder")))
.build())
.build())
// Use VPC network configuration
.vpc(vpc)
.subnetSelection(SubnetSelection.builder().subnetType(SubnetType.PUBLIC).build())
.securityGroups(List.of(SecurityGroup.fromSecurityGroupId(this, "SecurityGroup", vpc.getVpcDefaultSecurityGroup())))
.keyPair(KeyPair.fromKeyPairName(this, "KeyPair", "imagebuilder-instance-key-pair"))
.terminateInstanceOnFailure(true)
// Optional - IMDSv2 settings
.httpTokens(HttpTokens.REQUIRED)
.httpPutResponseHopLimit(1)
// Optional - publish image completion messages to an SNS topic
.notificationTopic(Topic.fromTopicArn(this, "Topic", this.formatArn(ArnComponents.builder().service("sns").resource("image-builder-topic").build())))
// Optional - log settings. Logging is enabled by default
.logging(InfrastructureConfigurationLogging.builder()
.s3Bucket(Bucket.fromBucketName(this, "LogBucket", String.format("imagebuilder-logging-%s", Aws.ACCOUNT_ID)))
.s3KeyPrefix("imagebuilder-logs")
.build())
// Optional - host placement settings
.ec2InstanceAvailabilityZone(Stack.of(this).getAvailabilityZones()[0])
.ec2InstanceHostId(dedicatedHost.getAttrHostId())
.ec2InstanceTenancy(Tenancy.HOST)
.resourceTags(Map.of(
"Environment", "production"))
.build();
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
-
Enum Constant Details
-
DEFAULT
(experimental) Instances will be launched with default tenancy. -
DEDICATED
(experimental) Instances will be launched with dedicated tenancy. -
HOST
(experimental) Instances will be launched on a dedicated host.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-