Class InfrastructureConfigurationProps
(experimental) Properties for creating an Infrastructure Configuration resource.
Implements
Inherited Members
Namespace: Amazon.CDK.AWS.ImageBuilder.Alpha
Assembly: Amazon.CDK.AWS.ImageBuilder.Alpha.dll
Syntax (csharp)
public class InfrastructureConfigurationProps : IInfrastructureConfigurationProps
Syntax (vb)
Public Class InfrastructureConfigurationProps Implements IInfrastructureConfigurationProps
Remarks
Stability: Experimental
ExampleMetadata: infused
Examples
var infrastructureConfiguration = new InfrastructureConfiguration(this, "Infrastructure", new InfrastructureConfigurationProps {
InfrastructureConfigurationName = "production-infrastructure",
InstanceTypes = new [] { InstanceType.Of(InstanceClass.COMPUTE7_INTEL, InstanceSize.LARGE) },
Vpc = vpc,
SubnetSelection = new SubnetSelection { SubnetType = SubnetType.PRIVATE_WITH_EGRESS }
});
var distributionConfiguration = new DistributionConfiguration(this, "Distribution");
distributionConfiguration.AddAmiDistributions(new AmiDistribution {
AmiName = "production-ami-{{ imagebuilder:buildDate }}",
AmiTargetAccountIds = new [] { "123456789012", "098765432109" }
});
var productionPipeline = new ImagePipeline(this, "ProductionPipeline", new ImagePipelineProps {
Recipe = exampleImageRecipe,
InfrastructureConfiguration = infrastructureConfiguration,
DistributionConfiguration = distributionConfiguration
});
Synopsis
Constructors
| InfrastructureConfigurationProps() | (experimental) Properties for creating an Infrastructure Configuration resource. |
Properties
| Description | (experimental) The description of the infrastructure configuration. |
| Ec2InstanceAvailabilityZone | (experimental) The availability zone to place Image Builder build and test EC2 instances. |
| Ec2InstanceHostId | (experimental) The ID of the Dedicated Host on which build and test instances run. |
| Ec2InstanceHostResourceGroupArn | (experimental) The ARN of the host resource group on which build and test instances run. |
| Ec2InstanceTenancy | (experimental) The tenancy of the instance. |
| HttpPutResponseHopLimit | (experimental) The maximum number of hops that an instance metadata request can traverse to reach its destination. |
| HttpTokens | (experimental) Indicates whether a signed token header is required for instance metadata retrieval requests. |
| InfrastructureConfigurationName | (experimental) The name of the infrastructure configuration. |
| InstanceProfile | (experimental) The instance profile to associate with the instance used to customize the AMI. |
| InstanceTypes | (experimental) The instance types to launch build and test EC2 instances with. |
| KeyPair | (experimental) The key pair used to connect to the build and test EC2 instances. |
| Logging | (experimental) The log settings for detailed build logging. |
| NotificationTopic | (experimental) The SNS topic on which notifications are sent when an image build completes. |
| ResourceTags | (experimental) The additional tags to assign to the Amazon EC2 instance that Image Builder launches during the build process. |
| Role | (experimental) An IAM role to associate with the instance profile used by Image Builder. |
| SecurityGroups | (experimental) The security groups to associate with the instance used to customize the AMI. |
| SubnetSelection | (experimental) Select which subnet to place the instance used to customize the AMI. |
| Tags | (experimental) The tags to apply to the infrastructure configuration. |
| TerminateInstanceOnFailure | (experimental) Whether to terminate the EC2 instance when the build or test workflow fails. |
| Vpc | (experimental) The VPC to place the instance used to customize the AMI. |
Constructors
InfrastructureConfigurationProps()
(experimental) Properties for creating an Infrastructure Configuration resource.
public InfrastructureConfigurationProps()
Remarks
Stability: Experimental
ExampleMetadata: infused
Examples
var infrastructureConfiguration = new InfrastructureConfiguration(this, "Infrastructure", new InfrastructureConfigurationProps {
InfrastructureConfigurationName = "production-infrastructure",
InstanceTypes = new [] { InstanceType.Of(InstanceClass.COMPUTE7_INTEL, InstanceSize.LARGE) },
Vpc = vpc,
SubnetSelection = new SubnetSelection { SubnetType = SubnetType.PRIVATE_WITH_EGRESS }
});
var distributionConfiguration = new DistributionConfiguration(this, "Distribution");
distributionConfiguration.AddAmiDistributions(new AmiDistribution {
AmiName = "production-ami-{{ imagebuilder:buildDate }}",
AmiTargetAccountIds = new [] { "123456789012", "098765432109" }
});
var productionPipeline = new ImagePipeline(this, "ProductionPipeline", new ImagePipelineProps {
Recipe = exampleImageRecipe,
InfrastructureConfiguration = infrastructureConfiguration,
DistributionConfiguration = distributionConfiguration
});
Properties
Description
(experimental) The description of the infrastructure configuration.
public string? Description { get; set; }
Property Value
Remarks
Default: None
Stability: Experimental
Ec2InstanceAvailabilityZone
(experimental) The availability zone to place Image Builder build and test EC2 instances.
public string? Ec2InstanceAvailabilityZone { get; set; }
Property Value
Remarks
Default: EC2 will select a random zone
Stability: Experimental
Ec2InstanceHostId
(experimental) The ID of the Dedicated Host on which build and test instances run.
public string? Ec2InstanceHostId { get; set; }
Property Value
Remarks
This only applies if the instance tenancy is
host. This cannot be used with the ec2InstanceHostResourceGroupArn parameter.
Default: None
Stability: Experimental
Ec2InstanceHostResourceGroupArn
(experimental) The ARN of the host resource group on which build and test instances run.
public string? Ec2InstanceHostResourceGroupArn { get; set; }
Property Value
Remarks
This only applies if the instance tenancy
is host. This cannot be used with the ec2InstanceHostId parameter.
Default: None
Stability: Experimental
Ec2InstanceTenancy
(experimental) The tenancy of the instance.
public Tenancy? Ec2InstanceTenancy { get; set; }
Property Value
Remarks
Dedicated tenancy runs instances on single-tenant hardware, while host tenancy runs instances on a dedicated host. Shared tenancy is used by default.
Default: Tenancy.DEFAULT
Stability: Experimental
HttpPutResponseHopLimit
(experimental) The maximum number of hops that an instance metadata request can traverse to reach its destination.
public double? HttpPutResponseHopLimit { get; set; }
Property Value
Remarks
By default, this is set to 2.
Default: 2
Stability: Experimental
HttpTokens
(experimental) Indicates whether a signed token header is required for instance metadata retrieval requests.
public HttpTokens? HttpTokens { get; set; }
Property Value
Remarks
By default, this is
set to required to require IMDSv2 on build and test EC2 instances.
Default: HttpTokens.REQUIRED
Stability: Experimental
InfrastructureConfigurationName
(experimental) The name of the infrastructure configuration.
public string? InfrastructureConfigurationName { get; set; }
Property Value
Remarks
This name must be normalized by transforming all alphabetical characters to lowercase, and replacing all spaces and underscores with hyphens.
Default: A name is generated
Stability: Experimental
InstanceProfile
(experimental) The instance profile to associate with the instance used to customize the AMI.
public IInstanceProfile? InstanceProfile { get; set; }
Property Value
Remarks
By default, an instance profile and role will be created with minimal permissions needed to build the image, attached to the EC2 instance.
If an S3 logging bucket and key prefix is provided, an IAM inline policy will be attached to the instance profile's role, allowing s3:PutObject permissions on the bucket.
Default: An instance profile will be generated
Stability: Experimental
InstanceTypes
(experimental) The instance types to launch build and test EC2 instances with.
public InstanceType[]? InstanceTypes { get; set; }
Property Value
Remarks
Default: Image Builder will choose from a default set of instance types compatible with the AMI
Stability: Experimental
KeyPair
(experimental) The key pair used to connect to the build and test EC2 instances.
public IKeyPair? KeyPair { get; set; }
Property Value
Remarks
The key pair can be used to log into the build or test instances for troubleshooting any failures.
Default: None
Stability: Experimental
Logging
(experimental) The log settings for detailed build logging.
public IInfrastructureConfigurationLogging? Logging { get; set; }
Property Value
IInfrastructureConfigurationLogging
Remarks
Default: None
Stability: Experimental
NotificationTopic
(experimental) The SNS topic on which notifications are sent when an image build completes.
public ITopic? NotificationTopic { get; set; }
Property Value
Remarks
Default: No notifications are sent
Stability: Experimental
ResourceTags
(experimental) The additional tags to assign to the Amazon EC2 instance that Image Builder launches during the build process.
public IDictionary<string, string>? ResourceTags { get; set; }
Property Value
Remarks
Default: None
Stability: Experimental
Role
(experimental) An IAM role to associate with the instance profile used by Image Builder.
public IRole? Role { get; set; }
Property Value
Remarks
The role must be assumable by the service principal ec2.amazonaws.com:
Note: You can provide an instanceProfile or a role, but not both.
Default: A role will automatically be created, it can be accessed via the role property
Stability: Experimental
Examples
var instanceProfileRole = new Role(this, "MyRole", new RoleProps {
AssumedBy = new ServicePrincipal("ec2.amazonaws.com")
});
SecurityGroups
(experimental) The security groups to associate with the instance used to customize the AMI.
public ISecurityGroup[]? SecurityGroups { get; set; }
Property Value
Remarks
Default: The default security group for the VPC will be used
Stability: Experimental
SubnetSelection
(experimental) Select which subnet to place the instance used to customize the AMI.
public ISubnetSelection? SubnetSelection { get; set; }
Property Value
Remarks
The first subnet that is selected will be used. You must specify the VPC to customize the subnet selection.
Default: The first subnet selected from the provided VPC will be used
Stability: Experimental
Tags
(experimental) The tags to apply to the infrastructure configuration.
public IDictionary<string, string>? Tags { get; set; }
Property Value
Remarks
Default: None
Stability: Experimental
TerminateInstanceOnFailure
(experimental) Whether to terminate the EC2 instance when the build or test workflow fails.
public bool? TerminateInstanceOnFailure { get; set; }
Property Value
bool?
Remarks
Default: true
Stability: Experimental
Vpc
(experimental) The VPC to place the instance used to customize the AMI.
public IVpc? Vpc { get; set; }
Property Value
Remarks
Default: The default VPC will be used
Stability: Experimental