Deploy stage failed with incorrect artifactlocation
General Issue
CDK Python CI/CD Deployment Stage error
The Question
Receiving error in Deployment stage which incorporating CI/CD pipeline using CDK python. Need your input to correct the mistake here in this.
CDK CLI Version
2.13.0
Framework Version
No response
Node.js Version
6.3.0
OS
No response
Language
Python
Language Version
3.9.9
Other information
Setting up a CI/CD pipeline to push the Python stack. However, the Pipeline fails at the Deployment step with the message S3 access refused. Here is the code for my stack. Throughout this, Artifact is saved in the specified S3 Bucket. During deployment, the following issue was encountered.

app.py
app = cdk.App()
PocdataopsStack(app, "PocdataopsStack", env=cdk.Environment(account=os.getenv('CDK_DEFAULT_ACCOUNT'), region=os.getenv('CDK_DEFAULT_REGION')),)
PipelineStack(app, "PipelineStack", env=cdk.Environment(account=os.getenv('CDK_DEFAULT_ACCOUNT'), region=os.getenv('CDK_DEFAULT_REGION')),)
app.synth()
Pipeline Stack
` class PipelineStack(cdk.Stack): def init(self, scope: Construct, construct_id: str, **kwargs) -> None: super().init(scope, construct_id, **kwargs)
cdk_build_output = codepipeline.Artifact()
source_artifact = codepipeline.Artifact()
pipeline_role = aws_iam.Role.from_role_arn(
self, "Pipelinerole", "arn:aws:iam::xxxxxxxxx:role/pipelinedataops"
)
codeRepo = codecommit.Repository.from_repository_name(
self, "CodeCommitRepository",
repository_name=V_Name
)
pipeline_s3_bucket = aws_s3.Bucket.from_bucket_name(
self, "DataopsBucket", bucket_name=V_PipelineBucket
)
pipeline = codepipeline.Pipeline(
self, "DataopsCDKPipeline",
artifact_bucket=pipeline_s3_bucket,
pipeline_name=V_Name,
cross_account_keys=False,
role=pipeline_role
)
source_action = pipeline.add_stage(
stage_name="Source",
actions= [
codepipelineaction.CodeCommitSourceAction(
action_name="SourceCommit",
repository=codeRepo,
output=source_artifact,
event_role=pipeline_role
)
]
)
buildStage = aws_codebuild.PipelineProject(
self, "Build", build_spec=aws_codebuild.BuildSpec.from_object(
{
'version': '0.2',
'phases': {
'install': {
'runtime-versions': {
'python': 3.9
},
'commands': [
'npm install -g aws-cdk',
'pip install -r requirements.txt'
]
},
'build': {
'commands': 'cdk synth'
}
},
'artifacts': {
'base-direcroty': './cdk-out',
'files': ['**/*'],
}
}
)
)
# build stage
pipeline.add_stage(
stage_name='Build',
actions=[
codepipelineaction.CodeBuildAction(
action_name='Build_CodeBuild',
project=buildStage,
input=source_artifact,
outputs=[cdk_build_output]
)
]
)
# Deloy Stage
pipeline.add_stage(
stage_name="Deploy",
actions=[
codepipelineaction.CloudFormationCreateUpdateStackAction(
action_name='Deploy_Stack',
template_path=cdk_build_output.at_path("dataops-deploy.json"),
stack_name="pocdataops",
admin_permissions=True,
role=pipeline_role,
deployment_role=pipeline_role
)
]
)
`