Commit b0dc0b58 authored by Rayan  CHIKHI's avatar Rayan CHIKHI
Browse files

added less generic names in cloudformation

parent 2ddd9ed1
aws lambda add-permission --function-name BatchProcessingLambdaInvokeFunction --principal s3.amazonaws.com \
--statement-id s3invoke --action "lambda:InvokeFunction" \
--source-arn arn:aws:s3:::serratus-rayan \
--source-account $(aws sts get-caller-identity --query Account --output text)
......@@ -100,7 +100,7 @@ Resources:
- arn:aws:iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role
- arn:aws:iam::aws:policy/AmazonS3FullAccess
SpotIamFleetRole: # taken from https://github.com/aodn/aws-wps/blob/master/wps-cloudformation-template.yaml
RayanUnitigsSpotIamFleetRole: # taken from https://github.com/aodn/aws-wps/blob/master/wps-cloudformation-template.yaml
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
......@@ -116,11 +116,11 @@ Resources:
Action: sts:AssumeRole
ManagedPolicyArns:
- arn:aws:iam::aws:policy/service-role/AmazonEC2SpotFleetTaggingRole
BatchProcessingJobDefinition:
RayanUnitigsBatchProcessingJobDefinition:
Type: AWS::Batch::JobDefinition
Properties:
Type: container
JobDefinitionName: BatchJobDefinition
JobDefinitionName: RayanUnitigsBatchJobDefinition
ContainerProperties:
Image:
Fn::Join:
......@@ -140,16 +140,16 @@ Resources:
Name: temp_dir
RetryStrategy:
Attempts: 1
BatchProcessingJobQueue:
RayanUnitigsBatchProcessingJobQueue:
Type: AWS::Batch::JobQueue
Properties:
JobQueueName: BatchProcessingJobQueue
JobQueueName: RayanUnitigsBatchProcessingJobQueue
Priority: 1
ComputeEnvironmentOrder:
- Order: 1
ComputeEnvironment:
Ref: ComputeEnvironment
ComputeEnvironment:
Ref: RayanUnitigsComputeEnvironment
RayanUnitigsComputeEnvironment:
Type: AWS::Batch::ComputeEnvironment
Properties:
Type: MANAGED
......@@ -163,7 +163,7 @@ Resources:
- c5d
#- optimal
BidPercentage: 100
SpotIamFleetRole: !Ref SpotIamFleetRole
SpotIamFleetRole: !Ref RayanUnitigsSpotIamFleetRole
Subnets:
- Ref: Subnet
SecurityGroupIds:
......@@ -227,16 +227,16 @@ Resources:
--==MYBOUNDARY==--
BatchProcessS3Bucket:
RayanUnitigsBatchProcessS3Bucket:
Type: AWS::S3::Bucket
DependsOn: BatchProcessBucketPermission
DependsOn: RayanUnitigsBatchProcessBucketPermission
Properties:
BucketName:
!Sub 'aws-unitigs-${AWS::AccountId}'
NotificationConfiguration:
LambdaConfigurations:
- Event: 's3:ObjectCreated:*'
Function: !GetAtt BatchProcessingLambdaInvokeFunction.Arn
Function: !GetAtt RayanUnitigsBatchProcessingLambdaInvokeFunction.Arn
Filter:
S3Key:
Rules:
......@@ -244,18 +244,18 @@ Resources:
Value: '.fastq'
BatchProcessBucketPermission:
RayanUnitigsBatchProcessBucketPermission:
Type: AWS::Lambda::Permission
Properties:
Action: 'lambda:InvokeFunction'
FunctionName: !Ref BatchProcessingLambdaInvokeFunction
FunctionName: !Ref RayanUnitigsBatchProcessingLambdaInvokeFunction
Principal: s3.amazonaws.com
SourceAccount: !Ref "AWS::AccountId"
SourceArn: !Sub "arn:aws:s3:::aws-unitigs-${AWS::AccountId}"
BatchProcessingLambdaInvokeFunction:
RayanUnitigsBatchProcessingLambdaInvokeFunction:
Type: AWS::Lambda::Function
Properties:
FunctionName: BatchProcessingLambdaInvokeFunction
FunctionName: RayanUnitigsBatchProcessingLambdaInvokeFunction
Description: Python Function Handler that would be triggered BY s3 events TO the aws batch
Handler: index.lambda_handler
Runtime: python3.6
......@@ -292,9 +292,9 @@ Resources:
out = out + " " + batchCommand
print(out)
response = batch.submit_job(jobName='BatchProcessingJobQueue',
jobQueue='BatchProcessingJobQueue',
jobDefinition='BatchJobDefinition',
response = batch.submit_job(jobName='RayanUnitigsBatchProcessingJobQueue',
jobQueue='RayanUnitigsBatchProcessingJobQueue',
jobDefinition='RayanUnitigsBatchJobDefinition',
containerOverrides={
"command": [ "python", "batch_processor.py", batchCommand ],
"environment": [
......@@ -311,16 +311,16 @@ Resources:
Outputs:
ComputeEnvironmentArn:
Value:
Ref: ComputeEnvironment
Ref: RayanUnitigsComputeEnvironment
BatchProcessingJobQueueArn:
Value:
Ref: BatchProcessingJobQueue
Ref: RayanUnitigsBatchProcessingJobQueue
BatchProcessingJobDefinitionArn:
Value:
Ref: BatchProcessingJobDefinition
Ref: RayanUnitigsBatchProcessingJobDefinition
BucketName:
Value:
Ref: BatchProcessS3Bucket
Ref: RayanUnitigsBatchProcessS3Bucket
LambdaName:
Value:
Ref: BatchProcessingLambdaInvokeFunction
Ref: RayanUnitigsBatchProcessingLambdaInvokeFunction
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment