34 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
import boto3
 | 
						|
 | 
						|
################################################################################################
 | 
						|
#
 | 
						|
# Configuration Parameters
 | 
						|
#
 | 
						|
################################################################################################
 | 
						|
 | 
						|
# region = 'eu-central-1'
 | 
						|
region = 'us-east-1'
 | 
						|
functionName = 'cloudcomp-counter-lambda-demo'
 | 
						|
# roleName = 'arn:aws:iam::309000625112:role/service-role/cloudcomp-counter-demo-role-6rs7pah3'
 | 
						|
roleName = 'arn:aws:iam::919927306708:role/cloudcomp-s3-access'
 | 
						|
 | 
						|
################################################################################################
 | 
						|
#
 | 
						|
# boto3 code
 | 
						|
#
 | 
						|
################################################################################################
 | 
						|
 | 
						|
 | 
						|
client = boto3.setup_default_session(region_name=region)
 | 
						|
lClient = boto3.client('lambda')
 | 
						|
 | 
						|
 | 
						|
print("Deleting old function...")
 | 
						|
print("------------------------------------")
 | 
						|
try:
 | 
						|
    response = lClient.delete_function(
 | 
						|
        FunctionName=functionName,
 | 
						|
    )
 | 
						|
except lClient.exceptions.ResourceNotFoundException:
 | 
						|
    print('Function not available. No need to delete it.')
 |