AwsS3Bucket
Service-level AWS S3 bucket component.
Remarks
This component always creates one base awsNative.s3.Bucket and composes optional service-level S3 capabilities through inline bucket properties where possible. A separate awsNative.s3.BucketPolicy resource is created when policy or enforceSecureTransport is configured.
Naming:
- Root type token:
${namespace}:aws:AwsS3Bucket; capability literal:s3. The root is${env}-${projectHash}-s3-${sanitiseNamePart(args.bucketName)}, whereargs.bucketNameis shared with the AWS bucket purpose. aws-native:s3:Bucket,aws:s3/bucketAcl:BucketAcl, andaws-native:s3:BucketPolicychild candidate tuples are each[args.bucketName]; their final logical name is${env}-${projectHash}-${sanitiseNamePart(args.bucketName)}.- The bucket AWS name uses the
stackAccountPurposestyle${env}-${projectHash}-${accountHash}-${bucketName}, withbucketNamevalidated as a strict camelCase purpose and lowercased (S3 forbids uppercase), to guarantee global uniqueness across accounts. - Bucket ACL and policy set no AWS name. Lambda invoke permissions are owned by the referenced Lambda component; this component supplies only
args.bucketNameas its source-side relationship identity and the source values. The Lambda component separately adds the function identity ands3service discriminator.
Example
const bucket = new AwsS3Bucket({
bucketName: 'mediaStorageProd',
intelligentTiering: true,
lifecycleRules: [
{
id: 'expire-old-uploads',
status: 'Enabled',
filterPrefix: 'uploads/',
expiration: {
days: 30,
},
},
],
notifications: {
sqs: [
{
eventTypes: ['s3:ObjectCreated:*'],
queueArn: uploadQueue.arn,
},
],
},
});Constructors
new AwsS3Bucket(
args: AwsS3BucketArgs,
options?: ComponentResourceOptions,
): AwsS3Bucket
Parameters
args(AwsS3BucketArgs) — Component inputs controlling bucket creation and optional S3 capabilities.The component logical name is derived fromargs.bucketName.options(ComponentResourceOptions, optional) — Optional settings controlling resource behaviour.
Returns
AwsS3Bucket
Hierarchy
ComponentResourceAwsS3Bucket
Properties
bucket: Bucket
The underlying AWS S3 bucket resource.
bucketAcl: BucketAcl | undefined
Optional bucket ACL resource managed through the classic AWS provider.
bucketArn: Output<string>
The S3 bucket ARN.
bucketId: Output<string>
The S3 bucket ID.
bucketName: Output<string | undefined>
The effective S3 bucket name.
bucketPolicy: BucketPolicy | undefined
Optional bucket policy resource.
lambdaInvokePermissions: Resource[]
Optional Lambda invoke permission resources created for Lambda notifications.
urn: Output<string>
Inherited from urn
The stable logical URN used to distinctly address a resource, both before and after deployments.
Methods
getData(): Promise<any>
Inherited from getData
Retrieves the data produces by initialize. The data is immediately available in a derived class's constructor after the super(...) call to ComponentResource.
Returns
Promise<any>
getProvider(moduleMember: string): ProviderResource | undefined
Inherited from getProvider
Returns the provider for the given module member, if one exists.
Parameters
moduleMember(string)
Returns
ProviderResource | undefined
initialize(
args: Inputs,
opts?: ComponentResourceOptions,
name?: string,
type?: string,
): Promise<any>
Inherited from initialize
Can be overridden by a subclass to asynchronously initialize data for this component automatically when constructed. The data will be available immediately for subclass constructors to use. To access the data use getData.
Parameters
args(Inputs)opts(ComponentResourceOptions, optional)name(string, optional)type(string, optional)
Returns
Promise<any>
registerOutputs(
outputs?: Inputs | Promise<Inputs> | Output<Inputs>,
): void
Inherited from registerOutputs
Registers synthetic outputs that a component has initialized, usually by allocating other child sub-resources and propagating their resulting property values.
Component resources can call this at the end of their constructor to indicate that they are done creating child resources. This is not strictly necessary as this will automatically be called after the initialize method completes.
Parameters
outputs(Inputs | Promise<Inputs> | Output<Inputs>, optional)
Returns
void
Static Methods
isInstance(obj: any): obj is ComponentResource<any>
Inherited from isInstance
Returns true if the given object is a CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.
Parameters
obj(any)
Returns
obj is ComponentResource<any>