aws-cloudformation / aws-cloudformation/custom-resource-helper

Lambda seems to fail writting back to the pre-signed URL with a permissions error.

Open
#20 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
382
Forks
61
PR merge metrics
No merged PRs in 30d

Description

I have really simple lambda that I am using to test this, most of which from the repo. When I call this with the simple CFT I get the following error.

`[ERROR] 2019-07-23T23:18:38.572Z 53eb4c5b-fc49-4154-952e-a7f7b75bc1fe An error occurred (AccessDeniedException) when calling the PutRule operation:`

**Lambda**
`from crhelper import CfnResource
import logging

#Intiate Logger
logger = logging.getLogger(__name__)

# Initialise the helper, all inputs are optional, this example shows the defaults
helper = CfnResource(json_logging=False, log_level='DEBUG', boto_level='DEBUG')

#Define Netskope Vars
try:
myData= "123456789"
pass
except Exception as e:
helper.init_failure(e)

@helper.create
def create(event, context):
logger.info("Got Create")

helper.Data.update({"myData": myData})
return True

@helper.delete
def delete(event, context):
logger.info("Got Delete")
# Delete never returns anything. Should not fail if the underlying resources are already deleted. Desired state.

@helper.poll_create
def poll_create(event, context):
logger.info("Got create poll")
# Return a resource id or True to indicate that creation is complete. if True is returned an id will be generated
return True

def lambda_handler(event, context):
helper(event, context)`

**CFT**
`---
AWSTemplateFormatVersion: '2010-09-09'
Parameters: {}
Resources:
MyCustom:
Type: Custom::Test
Properties:
ServiceToken: arn:aws:lambda:...
`

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure with the supplied Lambda code and CloudFormation template, then inspect the reported PutRule AccessDeniedException and the custom-resource response flow. Done means determining whether the failure is in the helper or the deployment configuration and documenting a verified resolution.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python
Domain
cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.