If you are looking for more details, kindly visit qunfeng.
CD-ROM parts of computer. We can manufacture all kinds of metal stamping parts. We do these products according to your drawing and samples. If you interested in our products, please feel free
This post was co-authored by Ravi Intodia, Senior Technology Architect, Infosys Technologies Ltd, Nirmal Tomar, Principal Consultant, Infosys Technologies Ltd and Ashutosh Pateriya, Solution Architect, AWS.
Today's businesses must contend with fast-changing competitive environments, expanding security needs, and scalability issues. Businesses must find a way to reconcile the need for operational stability with the need for quick product development. Continuous integration and continuous delivery (CI/CD) enables rapid software iterations while maintaining system stability and security.
With an increase in AWS Cloud and DevOps adoption, many organizations seek solutions which go beyond geographical boundaries. AWS CodePipeline, along with its related services, lets you integrate and deploy your solutions across multiple AWS accounts and Regions. However, it becomes more challenging when you want to deploy your application in multiple AWS Regions as well as in China, due to the unavailability of AWS CodePipeline in the Beijing and Ningxia Regions.
In this blog post, you will learn how to overcome the unique challenges when deploying applications across many parts of the world, including China. For this solution, we will use the power and flexibility of AWS CodeBuild to implement AWS Command Line Interface (AWS CLI) commands to perform custom actions that are not directly supported by CodePipeline or AWS CodeDeploy.
CodePipeline for multi-account and multi-Region deployment consists of the following components:
Although the solution works for most Regions, we encounter challenges when we try to expand our current worldwide solutions into the China Regions.
The challenges are as follows:
Due to the lack of cross-account roles and the CodePipeline service, setting up a worldwide CI/CD pipeline that includes the China Regions is not automatically supported.
In the proposed solution, we will build and deploy the application to both Regions using the AWS CI/CD services from the non-China Region, and we will create an access key in a China Region with access to deploy the application using services, such as AWS Lambda, AWS Elastic Beanstalk, Amazon Elastic Container Service, and Amazon Elastic Kubernetes Service. This access key is stored in a non-China account as an SSM parameter after encryption. On committing, the CodePipeline in the non-China Region is initiated, and it builds the package and deploys the application in both Regions from a single place.
In this architecture, AWS CLI commands are used to set an AWS profile of CodeBuild instance with China credentials (retrieved from the AWS Systems Manager Parameter Store). This enables a CodeBuild instance to run an AWS CloudFormation package and deploy commands directly on the China account, thereby deploying required resources in the desired China Region.
This solution is not relying on any AWS CI/CD services like CodeDeploy in the China Region. With this solution we can create a complete CI/CD pipeline running in an AWS Region that can deploy an application in both Regions.
The following key components are needed for deployment:
'arn:aws-cn' instead of 'arn:aws').buildspec.yml needs to be enhanced to perform build and deployment to China accounts, as mentioned in the following.This solution is built using CodePipeline, CodeCommit, CodeBuild, AWS Cloud'Formation templates, and IAM.
As a demonstration, let's deploy a Lambda function in us-east-1 and cn-north-1 and discuss the steps in detail. The same steps can be followed to deploy any other AWS service.
To create secure SSM parameters using the AWS CLI, refer to the Create a Systems Manager parameter (AWS CLI) tutorial.
To create secure SSM parameters using the AWS Management Console, refer to the Create a Systems Manager parameter (console) tutorial.
Note: Creating secure SSM parameters is not supported by CloudFormation templates. Also, as a security best practice, you should not have any sensitive information as part of CloudFormation templates to avoid any possible security breach.
buildspec yml files, one for us-east-1, and one for cn-north-1.
# Buildspec Reference Doc: https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html
version: 0.2
phases:
install:
runtime-versions:
python: 3.7
pre_build:
commands:
- echo "[+] Updating PIP...."
- pip install --upgrade pip
- echo "[+] Installing dependencies...."
#- Commands To Install required dependencies
- yum install zip unzip -y -q
- pip install awscli --upgrade
build:
commands:
- echo "Starting build `date` in `pwd`"
- echo "Starting SAM packaging `date` in `pwd`"
- aws cloudformation package --template-file cloudformation_template.yaml --s3-bucket ${S3_BUCKET} --output-template-file transform-packaged.yaml
# Additional package commands for cross-region deployments
- echo "SAM packaging completed on `date`"
- echo "Build completed `date` in `pwd`"
artifacts:
type: zip
files:
- transform-packaged.yaml
# - additional artifacts for cross-region deployments
discard-paths: yes
cache:
paths:
- '/root/.cache/pip'
# Buildspec Reference Doc: https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html
version: 0.2
phases:
install:
runtime-versions:
python: 3.7
pre_build:
commands:
- echo "[+] Updating PIP...."
- pip install --upgrade pip
- echo "[+] Installing dependencies...."
#- Commands To Install required dependencies
- yum install zip unzip -y -q
- pip install awscli --upgrade
# Setting China Region IAM User Profile
- echo "Start setting User Profile `date` in `pwd`"
- USER_ACCESS_KEY=`aws ssm get-parameter --name ${USER_ACCESS_KEY_SSM} --with-decryption --query Parameter.Value --output text`
- USER_SECRET_KEY=`aws ssm get-parameter --name ${USER_SECRET_KEY_SSM} --with-decryption --query Parameter.Value --output text`
- aws configure --profile china set aws_access_key_id ${USER_ACCESS_KEY}
- aws configure --profile china set aws_secret_access_key ${USER_SECRET_KEY}
- echo "Setting User Profile Completed `date` in `pwd`"
build:
commands:
# Creating Deployment Package
- echo "Start build/packaging `date` in `pwd`"
- S3_BUCKET=`aws ssm get-parameter --name ${S3_BUCKET_SSM} --query Parameter.Value --output text`
- zip -q -r package.zip *
- >
bash -c '
aws cloudformation package
--template-file cloudformation_template_china.yaml
--s3-bucket ${S3_BUCKET}
--output-template-file transformed-template-china.yaml
--profile china
--region cn-north-1'
- echo "Completed build/packaging `date` in `pwd`"
post_build:
commands:
# Deploying
- echo "Start deployment `date` in `pwd`"
- >
bash -c '
aws cloudformation deploy
--capabilities CAPABILITY_NAMED_IAM
--template-file transformed-template-china.yaml
--stack-name ${ProjectName}-app-stack-dev
--profile china
--region cn-north-1'
- echo "Completed deployment `date` in `pwd`"
artifacts:
type: zip
files:
- package.zip
- transformed-template-china.yaml
Environment Variables: USER_ACCESS_KEY_SSM, USER_SECRET_KEY_SSM and S3_BUCKET_SSM
After creating and committing the previous files, your CodeCommit repository will look like the following.
The company is the world’s best Cd Screen Structure From China supplier. We are your one-stop shop for all needs. Our staff are highly-specialized and will help you find the product you need.
Now that we have a CodeCommit repository, next we will create a CodePipeline for Lambda with the following stages:
Congratulations! you have just created a CodePipeline with Lambda deployed in both a non-China Region and a China Region. Your CodePipeline should appear similar to the following.
Note: Actual CodePipeline view will be vertical only where all environment deployment will be one after the other. For the purpose of this example, we have placed them side-by-side to more easily showcase multiple environments.
We have created this pipeline with the following high-level steps, and you can add or remove steps as needed.
Step 1. After you commit the source code, CodePipeline will launch in the non-China Region and fetch the source code.
Step 2. Build the package using using buildspec.yml.
Step 3. Deploy the application in both Regions by following the subsection steps for development environment.
Step 4. Repeat step 3, but deploy the application in the staging environment.
Step 5. Wait for approval from your administrator or application owner before deploying application in production environment.
Step 6. Repeat steps 3 and 4 to deploy the application in the production environment.
To avoid incurring future charges, clean up the resources created as part of this blog post.
In this blog post, we have explored the question: how can you use AWS services to implement CI/CD in a China Region and keep them in sync with an AWS Region? Although we are using us-east-1 as an example here, this solution will work for any Region where CodePipeline services are available, including the China Region.
The question has been answered by dividing it into three problem statements as follows.
Problem 1: CodePipeline is not available in the China Regions.
Solution: Set up CodePipeline in a non-China Region and deploy to a China Region.
Problem 2: AWS cross-account roles are not possible between a non-China Region and the China Regions.
Solution: Use the power and flexibility of CodeBuild to build your application and also deploy your application using the AWS CLI.
Problem 3: Keep a non-China Region and the China Regions in sync.
Solution: Maintain all code and managing deployments from a common deployment AWS account.
AWS CodeCommit | Managed Source Control Service
AWS CodePipeline | Continuous Integration and Continuous Delivery
AWS CodeBuild ' Fully Managed Build Service
Ravi is a Senior Technology Architect primarily working on designing and implementing cloud native solutions. He is assisting clients in their cloud adoption journey and implementing cutting edge cloud-based solutions.
Nirmal is a principal consultant with Infosys, assisting vertical industries on application migration and modernization to the public cloud. He is the part of the Infosys Cloud CoE team and leads various initiatives with AWS. Nirmal has a keen interest in industry and cloud trends, and in working with hyperscaler to build differentiated offerings.
Nirmal also specializes in cloud native development, managed containerization solutions, data analytics, data lakes, IoT, AI, and machine learning solutions.
For more information, please visit Smart Waste Sorting Equipment China.