Experimental
@aws-cdk/aws-imagebuilder-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.
AmazonManagedComponent Class
Helper class for working with Amazon-managed components.
| Stability | Experimental |
|---|---|
| Source | lib/amazon-managed-component.ts |
Example
ts
const imageRecipe = new imagebuilder.ImageRecipe(this, 'AmazonManagedImageRecipe', {
baseImage: imagebuilder.BaseImage.fromSsmParameterName(
'/aws/service/ami-amazon-linux-latest/al2023-ami-minimal-kernel-default-x86_64'
),
components: [
{
component: imagebuilder.AmazonManagedComponent.updateOs(this, 'UpdateOS', {
platform: imagebuilder.Platform.LINUX
})
},
{
component: imagebuilder.AmazonManagedComponent.awsCliV2(this, 'AwsCli', {
platform: imagebuilder.Platform.LINUX
})
}
]
});
python
image_recipe = imagebuilder.ImageRecipe(self, "AmazonManagedImageRecipe",
base_image=imagebuilder.BaseImage.from_ssm_parameter_name("/aws/service/ami-amazon-linux-latest/al2023-ami-minimal-kernel-default-x86_64"),
components=[imagebuilder.ComponentConfiguration(
component=imagebuilder.AmazonManagedComponent.update_os(self, "UpdateOS",
platform=imagebuilder.Platform.LINUX
)
), imagebuilder.ComponentConfiguration(
component=imagebuilder.AmazonManagedComponent.aws_cli_v2(self, "AwsCli",
platform=imagebuilder.Platform.LINUX
)
)
]
)
java
ImageRecipe imageRecipe = ImageRecipe.Builder.create(this, "AmazonManagedImageRecipe")
.baseImage(BaseImage.fromSsmParameterName("/aws/service/ami-amazon-linux-latest/al2023-ami-minimal-kernel-default-x86_64"))
.components(List.of(ComponentConfiguration.builder()
.component(AmazonManagedComponent.updateOs(this, "UpdateOS", AmazonManagedComponentOptions.builder()
.platform(Platform.LINUX)
.build()))
.build(), ComponentConfiguration.builder()
.component(AmazonManagedComponent.awsCliV2(this, "AwsCli", AmazonManagedComponentOptions.builder()
.platform(Platform.LINUX)
.build()))
.build()))
.build();
csharp
// Install: dotnet add package Amazon.CDK.AWS.ImageBuilder.Alpha
var imageRecipe = new ImageRecipe(this, "AmazonManagedImageRecipe", new ImageRecipeProps {
BaseImage = BaseImage.FromSsmParameterName("/aws/service/ami-amazon-linux-latest/al2023-ami-minimal-kernel-default-x86_64"),
Components = new [] { new ComponentConfiguration {
Component = AmazonManagedComponent.UpdateOs(this, "UpdateOS", new AmazonManagedComponentOptions {
Platform = Platform.LINUX
})
}, new ComponentConfiguration {
Component = AmazonManagedComponent.AwsCliV2(this, "AwsCli", new AmazonManagedComponentOptions {
Platform = Platform.LINUX
})
} }
});
go
// Install: go get github.com/aws/aws-cdk-go/awsimagebuilderalpha/v2
imageRecipe := imagebuilder.NewImageRecipe(this, jsii.String("AmazonManagedImageRecipe"), &ImageRecipeProps{
BaseImage: imagebuilder.BaseImage_*FromSsmParameterName(jsii.String("/aws/service/ami-amazon-linux-latest/al2023-ami-minimal-kernel-default-x86_64")),
Components: []ComponentConfiguration{
&ComponentConfiguration{
Component: imagebuilder.AmazonManagedComponent_UpdateOs(this, jsii.String("UpdateOS"), &AmazonManagedComponentOptions{
Platform: imagebuilder.Platform_LINUX,
}),
},
&ComponentConfiguration{
Component: imagebuilder.AmazonManagedComponent_AwsCliV2(this, jsii.String("AwsCli"), &AmazonManagedComponentOptions{
Platform: imagebuilder.Platform_LINUX,
}),
},
},
})
Initializer
ts
new AmazonManagedComponent()
python
AmazonManagedComponent()
java
new AmazonManagedComponent()
csharp
new AmazonManagedComponent()
go
NewAmazonManagedComponent()
Methods
awsCliV2(scope: Construct, id: string, opts: AmazonManagedComponentOptions): IComponent@staticmethod def aws_cli_v2(scope: Construct, id: str, opts: AmazonManagedComponentOptions) -> IComponentpublic static IComponent awsCliV2(Construct scope, String id, AmazonManagedComponentOptions opts)public static IComponent AwsCliV2(Construct scope, string id, AmazonManagedComponentOptions opts)func AwsCliV2(Scope Construct, Id *string, Opts AmazonManagedComponentOptions) IComponent static #Imports the AWS CLI v2 Amazon-managed component.
3 parameters
Parameters
scopescopescopescopeScope— The construct scope.ididididId— Identifier of the construct.optsoptsoptsoptsOpts— The Amazon-managed component options.
fromAmazonManagedComponentAttributes(scope: Construct, id: string, attrs: AmazonManagedComponentAttributes): IComponent@staticmethod def from_amazon_managed_component_attributes(scope: Construct, id: str, attrs: AmazonManagedComponentAttributes) -> IComponentpublic static IComponent fromAmazonManagedComponentAttributes(Construct scope, String id, AmazonManagedComponentAttributes attrs)public static IComponent FromAmazonManagedComponentAttributes(Construct scope, string id, AmazonManagedComponentAttributes attrs)func FromAmazonManagedComponentAttributes(Scope Construct, Id *string, Attrs AmazonManagedComponentAttributes) IComponent static #Imports an Amazon-managed component from its attributes.
3 parameters
Parameters
scopescopescopescopeScope— The construct scope.ididididId— Identifier of the construct.attrsattrsattrsattrsAttrs— The Amazon-managed component attributes.
fromAmazonManagedComponentName(scope: Construct, id: string, amazonManagedComponentName: string): IComponent@staticmethod def from_amazon_managed_component_name(scope: Construct, id: str, amazon_managed_component_name: str) -> IComponentpublic static IComponent fromAmazonManagedComponentName(Construct scope, String id, String amazonManagedComponentName)public static IComponent FromAmazonManagedComponentName(Construct scope, string id, string amazonManagedComponentName)func FromAmazonManagedComponentName(Scope Construct, Id *string, AmazonManagedComponentName *string) IComponent static #Imports an Amazon-managed component from its name.
3 parameters
Parameters
scopescopescopescopeScope— The construct scope.ididididId— Identifier of the construct.amazonManagedComponentNameamazon_managed_component_nameamazonManagedComponentNameamazonManagedComponentNameAmazonManagedComponentName— - The name of the Amazon-managed component.
helloWorld(scope: Construct, id: string, opts: AmazonManagedComponentOptions): IComponent@staticmethod def hello_world(scope: Construct, id: str, opts: AmazonManagedComponentOptions) -> IComponentpublic static IComponent helloWorld(Construct scope, String id, AmazonManagedComponentOptions opts)public static IComponent HelloWorld(Construct scope, string id, AmazonManagedComponentOptions opts)func HelloWorld(Scope Construct, Id *string, Opts AmazonManagedComponentOptions) IComponent static #Imports the hello world Amazon-managed component.
3 parameters
Parameters
scopescopescopescopeScope— The construct scope.ididididId— Identifier of the construct.optsoptsoptsoptsOpts— The Amazon-managed component options.
python3(scope: Construct, id: string, opts: AmazonManagedComponentOptions): IComponent@staticmethod def python3(scope: Construct, id: str, opts: AmazonManagedComponentOptions) -> IComponentpublic static IComponent python3(Construct scope, String id, AmazonManagedComponentOptions opts)public static IComponent Python3(Construct scope, string id, AmazonManagedComponentOptions opts)func Python3(Scope Construct, Id *string, Opts AmazonManagedComponentOptions) IComponent static #Imports the Python 3 Amazon-managed component.
3 parameters
Parameters
scopescopescopescopeScope— The construct scope.ididididId— Identifier of the construct.optsoptsoptsoptsOpts— The Amazon-managed component options.
reboot(scope: Construct, id: string, opts: AmazonManagedComponentOptions): IComponent@staticmethod def reboot(scope: Construct, id: str, opts: AmazonManagedComponentOptions) -> IComponentpublic static IComponent reboot(Construct scope, String id, AmazonManagedComponentOptions opts)public static IComponent Reboot(Construct scope, string id, AmazonManagedComponentOptions opts)func Reboot(Scope Construct, Id *string, Opts AmazonManagedComponentOptions) IComponent static #Imports the reboot Amazon-managed component.
3 parameters
Parameters
scopescopescopescopeScope— The construct scope.ididididId— Identifier of the construct.optsoptsoptsoptsOpts— The Amazon-managed component options.
stigBuild(scope: Construct, id: string, opts: AmazonManagedComponentOptions): IComponent@staticmethod def stig_build(scope: Construct, id: str, opts: AmazonManagedComponentOptions) -> IComponentpublic static IComponent stigBuild(Construct scope, String id, AmazonManagedComponentOptions opts)public static IComponent StigBuild(Construct scope, string id, AmazonManagedComponentOptions opts)func StigBuild(Scope Construct, Id *string, Opts AmazonManagedComponentOptions) IComponent static #Imports the STIG hardening Amazon-managed component.
3 parameters
Parameters
scopescopescopescopeScope— The construct scope.ididididId— Identifier of the construct.optsoptsoptsoptsOpts— The Amazon-managed component options.
updateOs(scope: Construct, id: string, opts: AmazonManagedComponentOptions): IComponent@staticmethod def update_os(scope: Construct, id: str, opts: AmazonManagedComponentOptions) -> IComponentpublic static IComponent updateOs(Construct scope, String id, AmazonManagedComponentOptions opts)public static IComponent UpdateOs(Construct scope, string id, AmazonManagedComponentOptions opts)func UpdateOs(Scope Construct, Id *string, Opts AmazonManagedComponentOptions) IComponent static #Imports the OS update Amazon-managed component.
3 parameters
Parameters
scopescopescopescopeScope— The construct scope.ididididId— Identifier of the construct.optsoptsoptsoptsOpts— The Amazon-managed component attributes.